Project

General

Profile

« Previous | Next » 

Revision c90aca24

Added by Leszek Koltunski about 4 years ago

Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)

View differences:

src/main/java/org/distorted/library/mesh/MeshSphere.java
38 38
  // Single row is (longitude of V1, longitude of V2, (common) latitude of V1 and V2, latitude of V3)
39 39
  // longitude of V3 is simply midpoint of V1 and V2 so we don't have to specify it here.
40 40

  
41
  private static final double FACES[][] =      {
41
  private static final double[][] FACES =      {
42 42

  
43 43
      { 0.00*P, 0.25*P, 0.0, 0.5*P },
44 44
      { 0.25*P, 0.50*P, 0.0, 0.5*P },
......
79 79

  
80 80
  private void repeatVertex(float[] attribs)
81 81
    {
82
    //android.util.Log.e("sphere", "repeat last!");
83

  
84 82
    if( currentVert>0 )
85 83
      {
86 84
      attribs[VERT_ATTRIBS*currentVert + POS_ATTRIB  ] = attribs[VERT_ATTRIBS*(currentVert-1) + POS_ATTRIB  ];
......
172 170
    double longitude = midLongitude(lonV1, lonV2, quotZ );
173 171
    double latitude  = midLatitude(latV12, latV3, quotY );
174 172

  
175
    //android.util.Log.e("sphere", "newVertex: long:"+lonPoint+" lat:"+latPoint+" column="+column+" row="+row);
176

  
177 173
    double sinLON = Math.sin(longitude);
178 174
    double cosLON = Math.cos(longitude);
179 175
    double sinLAT = Math.sin(latitude);
......
186 182
    double texX = 0.5 + longitude/(2*P);
187 183
    if( texX>=1.0 ) texX-=1.0;
188 184

  
189
    //android.util.Log.e("tex", "longitude = "+((int)(180.0*longitude/P))+" texX="+texX );
190

  
191 185
    double texY = 0.5 + latitude/P;
192 186

  
193 187
    attribs[VERT_ATTRIBS*currentVert + POS_ATTRIB  ] = x;  //
......
197 191
    attribs[VERT_ATTRIBS*currentVert + NOR_ATTRIB  ] = 2*x;//  the vertex coords, normal vector, and
198 192
    attribs[VERT_ATTRIBS*currentVert + NOR_ATTRIB+1] = 2*y;//  inflate vector have identical (x,y,z).
199 193
    attribs[VERT_ATTRIBS*currentVert + NOR_ATTRIB+2] = 2*z;//
200
                                                           //  TODO: think dialog_about some more efficient
194
                                                           //  TODO: think about some more efficient
201 195
    attribs[VERT_ATTRIBS*currentVert + INF_ATTRIB  ] = x;  //  representation.
202 196
    attribs[VERT_ATTRIBS*currentVert + INF_ATTRIB+1] = y;  //
203 197
    attribs[VERT_ATTRIBS*currentVert + INF_ATTRIB+2] = z;  //
......
259 253
   */
260 254
  public MeshSphere(int level)
261 255
    {
262
    super(1.0f);
263

  
264 256
    computeNumberOfVertices(level);
265 257
    float[] attribs= new float[VERT_ATTRIBS*numVertices];
266 258

  

Also available in: Unified diff