Search in sources :

Example 6 with PropertySource

use of com.gempukku.libgdx.graph.shader.property.PropertySource in project gdx-graph by MarcinSc.

the class BoneWeightPropertyProducer method createProperty.

@Override
public PropertySource createProperty(int index, String name, JsonValue data, PropertyLocation location, boolean designTime) {
    int boneWeightCount = data.getInt("maxBoneWeightCount", 4);
    Vector2[] defaultValue = new Vector2[boneWeightCount];
    for (int i = 0; i < boneWeightCount; i++) {
        defaultValue[i] = new Vector2(0, 1);
    }
    return new PropertySource(index, name, new BoneWeightFieldType(boneWeightCount), location, defaultValue);
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) PropertySource(com.gempukku.libgdx.graph.shader.property.PropertySource)

Example 7 with PropertySource

use of com.gempukku.libgdx.graph.shader.property.PropertySource in project gdx-graph by MarcinSc.

the class QuadParticleModel method updateParticleData.

@Override
public void updateParticleData(float[] particlesData, int particleOffset, VertexAttributes vertexAttributes, ObjectMap<String, String> attributeToPropertyMap, ObjectMap<String, PropertySource> properties, ObjectMap<String, Object> attributes) {
    int vertexLength = vertexAttributes.vertexSize / 4;
    for (VertexAttribute vertexAttribute : vertexAttributes) {
        String propertyName = attributeToPropertyMap.get(vertexAttribute.alias);
        if (propertyName != null) {
            int attributeOffset = vertexAttribute.offset / 4;
            PropertySource propertySource = properties.get(propertyName);
            Object attributeValue = attributes.get(propertyName);
            ParticlesUtil.setParticleAttribute(particlesData, particleOffset, VERTEX_COUNT, vertexLength, attributeOffset, propertySource, attributeValue);
        }
    }
}
Also used : VertexAttribute(com.badlogic.gdx.graphics.VertexAttribute) PropertySource(com.gempukku.libgdx.graph.shader.property.PropertySource)

Aggregations

PropertySource (com.gempukku.libgdx.graph.shader.property.PropertySource)7 VertexAttribute (com.badlogic.gdx.graphics.VertexAttribute)4 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)2 ObjectMap (com.badlogic.gdx.utils.ObjectMap)2 ShaderFieldType (com.gempukku.libgdx.graph.shader.field.ShaderFieldType)2 VertexAttributes (com.badlogic.gdx.graphics.VertexAttributes)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Array (com.badlogic.gdx.utils.Array)1 IntArray (com.badlogic.gdx.utils.IntArray)1 ArrayShaderFieldType (com.gempukku.libgdx.graph.shader.field.ArrayShaderFieldType)1 PropertyLocation (com.gempukku.libgdx.graph.shader.property.PropertyLocation)1 ValuePerVertex (com.gempukku.libgdx.graph.util.ValuePerVertex)1