Project

General

Profile

« Previous | Next » 

Revision 36d65d88

Added by Leszek Koltunski almost 4 years ago

Progress making it possible to apply Vertex Effects only to some Components of a Mesh.

View differences:

src/main/res/raw/main_vertex_shader.glsl
25 25
in vec3 a_Inflate;                   // This vector describes the direction this vertex needs to go when we 'inflate' the whole mesh.
26 26
                                     // If the mesh is locally smooth, this is equal to the normal vector. Otherwise (on sharp edges) - no.
27 27
in vec2 a_TexCoordinate;             // Per-vertex texture coordinate.
28
in float a_Association;              // Per-vertex association. Connects the vertex (really the mesh component the vertex is a member of)
28
in float a_Component;                // The component a vertex belongs to.
29 29
                                     // to a vertex effect. An effect will only be active on a vertex iff (a_Association & vAssociation[effect]) != 0.
30 30
                                     // ( see VertexEffect.retSection() )
31 31

  
......
49 49
uniform vec4 vUniforms[3*NUM_VERTEX];// i-th effect is 3 consecutive vec4's: [3*i], [3*i+1], [3*i+2].
50 50
                                     // The first vec4 is the Interpolated values,
51 51
                                     // second vec4: first float - cache, next 3: Center, the third -  the Region.
52
uniform int vAssociation[NUM_VERTEX];// Associations of the vertex effects. Those are used to connect an effect to a Mesh component.
52
uniform int vEffectAssoc[NUM_VERTEX];// Associations of the vertex effects. Those are used to connect an effect to a Mesh component.
53
uniform int vEffectCompo[NUM_VERTEX];// Components the vertex effects work on. Likewise used to conneect an effect to a Mesh component.
54
uniform int vComponAssoc[MAX_COMPON];// Associations of the component.
53 55

  
54 56
//////////////////////////////////////////////////////////////////////////////////////////////
55 57
// HELPER FUNCTIONS
......
104 106

  
105 107
#if NUM_VERTEX>0
106 108
  int effect=0;
109
  int component = int(a_Component);
107 110

  
108 111
  for(int i=0; i<vNumEffects; i++)
109 112
    {
110
    // ENABLED EFFECTS WILL BE INSERTED HERE
113
    if( ((vComponAssoc[component] & vEffectAssoc[i]) != 0) || (component == vEffectCompo[i]) )
114
      {
115
      // ENABLED EFFECTS WILL BE INSERTED HERE
111 116

  
117
      }
112 118
    effect+=3;
113 119
    }
114 120
#endif

Also available in: Unified diff