Project

General

Profile

« Previous | Next » 

Revision b35570ad

Added by Leszek Koltunski about 4 years ago

Minor.
Looks like MeshBase.join() actually works.

View differences:

src/main/java/org/distorted/library/mesh/MeshJoined.java
27 27
/**
28 28
 * Join a list of (probably already changed by Matrix Effects) Meshes into one.
29 29
 * <p>
30
 * Try to keep the origin (0,0,0) in the center of gravity of the whole thing.
30
 * You need to try and keep the origin (0,0,0) in the center of gravity of the whole thing.
31 31
 */
32 32
  public MeshJoined(MeshBase[] meshes)
33 33
    {
src/main/java/org/distorted/library/mesh/MeshTriangles.java
25 25
 */
26 26
public class MeshTriangles extends MeshBase
27 27
  {
28
  private static final float HEIGHT = (float)Math.sqrt(3)*0.5f;
29 28
  private int numVertices;
30 29
  private int remainingVert;
31 30

  
......
36 35
     remainingVert--;
37 36

  
38 37
     attribs[VERT_ATTRIBS*vertex + POS_ATTRIB  ] = x-0.5f;
39
     attribs[VERT_ATTRIBS*vertex + POS_ATTRIB+1] = y-HEIGHT/3;
38
     attribs[VERT_ATTRIBS*vertex + POS_ATTRIB+1] = y-0.5f;
40 39
     attribs[VERT_ATTRIBS*vertex + POS_ATTRIB+2] = 0.0f;
41 40

  
42 41
     attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB  ] = 0.0f;
......
44 43
     attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+2] = 1.0f;
45 44

  
46 45
     attribs[VERT_ATTRIBS*vertex + INF_ATTRIB  ] = (x-0.5f);
47
     attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+1] = (y-HEIGHT/3);
46
     attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+1] = (y-0.5f);
48 47
     attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+2] = 0.01f   ;  // Inflated surface needs to be slightly in front
49 48

  
50 49
     attribs[VERT_ATTRIBS*vertex + TEX_ATTRIB  ] = x;
......
84 83
     float sx = 0.0f;
85 84
     float sy = 0.0f;
86 85
     float dx = 0.5f/level;
87
     float dy = HEIGHT/level;
86
     float dy = 1.0f/level;
88 87
     int vertex = 0;
89 88

  
90 89
     for(int row=level; row>=1; row--)
......
108 107
   */
109 108
  public MeshTriangles(int level)
110 109
     {
111
     super(1,HEIGHT,0);
110
     super(1,1,0);
112 111

  
113 112
     computeNumberOfVertices(level);
114 113

  
src/main/res/raw/main_vertex_shader.glsl
181 181
#endif
182 182
   
183 183
  v_Position      = v;
184
  v_endPosition   = v + 0.3*u_Stretch*n;
184
  v_endPosition   = v + 0.2*u_Stretch*n;
185 185
  v_TexCoordinate = a_TexCoordinate;
186 186
  v_Normal        = normalize(vec3(u_MVMatrix*vec4(n,0.0)));
187 187
  gl_Position     = u_MVPMatrix*vec4(v,1.0);

Also available in: Unified diff