Java Code Examples for com.jme3.shader.VarType#Int

The following examples show how to use com.jme3.shader.VarType#Int . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SkeletonControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule in = im.getCapsule(this);
    skeleton = (Skeleton) in.readSavable("skeleton", null);
    
    numberOfBonesParam = (MatParamOverride) in.readSavable("numberOfBonesParam", null);
    boneMatricesParam = (MatParamOverride) in.readSavable("boneMatricesParam", null);
    
    if (numberOfBonesParam == null) {
        numberOfBonesParam = new MatParamOverride(VarType.Int, "NumberOfBones", null);
        boneMatricesParam = new MatParamOverride(VarType.Matrix4Array, "BoneMatrices", null);
        getSpatial().addMatParamOverride(numberOfBonesParam);
        getSpatial().addMatParamOverride(boneMatricesParam);
    }
}
 
Example 2
Source File: SkinningControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule in = im.getCapsule(this);
    armature = (Armature) in.readSavable("armature", null);

    numberOfJointsParam = (MatParamOverride) in.readSavable("numberOfBonesParam", null);
    jointMatricesParam = (MatParamOverride) in.readSavable("boneMatricesParam", null);

    if (numberOfJointsParam == null) {
        numberOfJointsParam = new MatParamOverride(VarType.Int, "NumberOfBones", null);
        jointMatricesParam = new MatParamOverride(VarType.Matrix4Array, "BoneMatrices", null);
        getSpatial().addMatParamOverride(numberOfJointsParam);
        getSpatial().addMatParamOverride(jointMatricesParam);
    }
}
 
Example 3
Source File: MaterialAdapter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private VarType getVarType(Object value) {
    if (value instanceof Float) return VarType.Float;
    if (value instanceof Integer) return VarType.Int;
    if (value instanceof Boolean) return VarType.Boolean;
    if (value instanceof ColorRGBA) return VarType.Vector4;
    if (value instanceof Vector4f) return VarType.Vector4;
    if (value instanceof Vector3f) return VarType.Vector3;
    if (value instanceof Vector2f) return VarType.Vector2;
    if (value instanceof Matrix3f) return VarType.Matrix3;
    if (value instanceof Matrix4f) return VarType.Matrix4;
    if (value instanceof String) return VarType.Boolean;
    throw new AssetLoadException("Unsupported material parameter type : " + value.getClass().getSimpleName());
}
 
Example 4
Source File: SkeletonControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a skeleton control. The list of targets will be acquired
 * automatically when the control is attached to a node.
 *
 * @param skeleton the skeleton
 */
public SkeletonControl(Skeleton skeleton) {
    if (skeleton == null) {
        throw new IllegalArgumentException("skeleton cannot be null");
    }
    this.skeleton = skeleton;
    this.numberOfBonesParam = new MatParamOverride(VarType.Int, "NumberOfBones", null);
    this.boneMatricesParam = new MatParamOverride(VarType.Matrix4Array, "BoneMatrices", null);
}
 
Example 5
Source File: SkinningControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a armature control. The list of targets will be acquired
 * automatically when the control is attached to a node.
 *
 * @param armature the armature
 */
public SkinningControl(Armature armature) {
    if (armature == null) {
        throw new IllegalArgumentException("armature cannot be null");
    }
    this.armature = armature;
    this.numberOfJointsParam = new MatParamOverride(VarType.Int, "NumberOfBones", null);
    this.jointMatricesParam = new MatParamOverride(VarType.Matrix4Array, "BoneMatrices", null);
}
 
Example 6
Source File: MPOTestUtils.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static MatParamOverride mpoInt(String name, int value) {
    return new MatParamOverride(VarType.Int, name, value);
}