Skip to content

Commit 7783a4d

Browse files
authored
Merge pull request jMonkeyEngine#2022 from Electrostat-Lab/blendspace-javadocs
com.jme3.anim.tween.action.BlendSpace: basic javadoc
2 parents becdf50 + adf1147 commit 7783a4d

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,95 @@
1+
/*
2+
* Copyright (c) 2009-2025 jMonkeyEngine
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are
7+
* met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
*
12+
* * Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
*
16+
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17+
* may be used to endorse or promote products derived from this software
18+
* without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
132
package com.jme3.anim.tween.action;
233

34+
/**
35+
* A provider interface which provides a value {@link BlendSpace#getWeight()} to control the blending between 2 successive actions in a {@link BlendAction}.
36+
* The blending weight is a read-only value, and it can be manipulated using the arbitrary value {@link BlendSpace#setValue(float)} during the application runtime.
37+
*
38+
* <p>
39+
* Notes about the blending action and its relations with the blending weight:
40+
* <ul>
41+
* <li> Blending is the action of mixing between 2 successive animation {@link BlendableAction}s by interpolating their transforms and
42+
* then applying the result on the assigned {@link HasLocalTransform} object, the {@link BlendSpace} provides this blending action with a blend weight value. </li>
43+
* <li> The blend weight is the value for the interpolation for the target transforms. </li>
44+
* <li> The blend weight value must be in this interval [0, 1]. </li>
45+
* </ul>
46+
* </p>
47+
*
48+
* <p>
49+
* Different blending weight case scenarios managed by {@link BlendAction} internally:
50+
* <ul>
51+
* <li> In case of (0 < Blending weight < 1), the blending is executed each update among 2 actions, the first action will use
52+
* a blend value of 1 and the second action will use the blend space weight as a value for the interpolation. </li>
53+
* <li> In case of (Blending weight = 0), the blending hasn't started yet, only the first action will be interpolated at (weight = 1). </li>
54+
* <li> In case of (Blending weight = 1), the blending is finished and only the second action will continue to run at (weight = 1). </li>
55+
* </ul>
56+
* </p>
57+
*
58+
* <p>
59+
* Notes about the blending weight value:
60+
* <ul>
61+
* <li> Negative values and values greater than 1 aren't allowed (i.e., extrapolations aren't allowed). </li>
62+
* <li> For more details, see {@link BlendAction#doInterpolate(double)} and {@link BlendAction#collectTransform(HasLocalTransform, Transform, float, BlendableAction)}. </li>
63+
* </ul>
64+
* </p>
65+
*
66+
* Created by Nehon.
67+
* @see LinearBlendSpace an example of blendspace implementation
68+
*/
369
public interface BlendSpace {
470

71+
/**
72+
* Adjusts the target blend action instance that will utilize the blend weight value provided by this blend-space implementation.
73+
*
74+
* @param action the blend action instance that will utilize this blend-space (not null).
75+
*/
576
public void setBlendAction(BlendAction action);
677

78+
/**
79+
* Provides the blend weight value to the assigned {@link BlendAction} instance,
80+
* this value will be used for interpolating a collection of actions' transformations (i.e., keyframes).
81+
*
82+
* @return the blending weight value in the range from 0 to 1,
83+
* negative values and values above 1 aren't allowed.
84+
* @see LinearBlendSpace#getWeight()
85+
*/
786
public float getWeight();
887

88+
/**
89+
* An arbitrary value used for adjusting the blending weight value.
90+
*
91+
* @param value the value in floats.
92+
* @see LinearBlendSpace#setValue(float)
93+
*/
994
public void setValue(float value);
1095
}

0 commit comments

Comments
 (0)