Project

General

Profile

« Previous | Next » 

Revision a2878a67

Added by Leszek Koltunski over 3 years ago

Remove the 'inflate' vertex attributs from the Mesh and file format, and replace that with a per-component 'inflate centers' (which are as of yet untested)

View differences:

src/main/res/raw/main_vertex_shader.glsl
22 22

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

  
32
out vec3 v_Position;                  //
30
out vec3 v_Position;                  // for Transform Feedback only
33 31
out vec3 v_endPosition;               // for Transform Feedback only
34

  
35
#ifdef PREAPPLY
36
out vec3 v_Inflate;                   // Transform Feedback for preapply effects
37
#endif
38

  
39 32
out vec3 v_Normal;                    //
40 33
out vec2 v_TexCoordinate;             //
41 34

  
......
46 39
uniform float u_Inflate;              // how much should we inflate (>0.0) or deflate (<0.0) the mesh.
47 40
uniform int u_TransformFeedback;      // are we doing the transform feedback now?
48 41

  
42
layout (std140, binding=4) uniform componentCenter
43
  {
44
  vec4 vComCenter[MAX_COMPON];        // centers of earch mesh component. 4 floats:
45
                                      // (x,y,z,unused)
46
  };
47

  
49 48
#if NUM_VERTEX>0
50 49
uniform int vNumEffects;              // total number of vertex effects
51 50
uniform ivec4 vProperties[NUM_VERTEX];// their properties, 4 ints:
......
58 57
                                      // The first vec4 is the Interpolated values,
59 58
                                      // second vec4: first float - cache, next 3: Center, the third -  the Region.
60 59

  
61
layout (std140, binding=3) uniform meshAssociation
60
layout (std140, binding=3) uniform componentAssociation
62 61
  {
63 62
  ivec4 vComAssoc[MAX_COMPON];        // component Associations, 4 ints:
64 63
                                      // 1: component's AND association
......
111 110

  
112 111
void main()
113 112
  {
114
  vec3 v = a_Position + u_Inflate*a_Inflate;
113
  int component = int(a_Component);
114
  vec3 v = a_Position + u_Inflate*(a_Position - vComCenter[component].xyz);
115 115
  vec3 n = a_Normal;
116 116

  
117
#ifdef PREAPPLY
118
  vec3 inf = a_Inflate;
119
#endif
120

  
121 117
#if NUM_VERTEX>0
122 118
  int effect=0;
123
  int component = int(a_Component);
124 119

  
125 120
  for(int i=0; i<vNumEffects; i++)
126 121
    {
......
136 131
#ifdef PREAPPLY
137 132
  v_Position   = v;
138 133
  v_endPosition= n;
139
  v_Inflate    = inf;
140 134
#else
141 135
  if( u_TransformFeedback == 1 )
142 136
    {

Also available in: Unified diff