Project

General

Profile

« Previous | Next » 

Revision d8295106

Added by Leszek Koltunski almost 6 years ago

One more improvement with texturing the Sphere.

Still one problem with texturing remains.

View differences:

src/main/java/org/distorted/library/mesh/MeshSphere.java
97 97
    float y = (float)(sinLAT        / sqrt2);
98 98
    float z = (float)(cosLAT*cosLON / sqrt2);
99 99

  
100
    double texX = 0.5 + longitude/(2*P);
101
    if( texX>=1.0 ) texX-=1.0;
102

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

  
105
    double texY = 0.5 + latitude/P;
106

  
100 107
    attribs[VERT_ATTRIBS*currentVert + POS_ATTRIB  ] = x;  //
101 108
    attribs[VERT_ATTRIBS*currentVert + POS_ATTRIB+1] = y;  //
102 109
    attribs[VERT_ATTRIBS*currentVert + POS_ATTRIB+2] = z;  //
......
109 116
    attribs[VERT_ATTRIBS*currentVert + INF_ATTRIB+1] = y;  //
110 117
    attribs[VERT_ATTRIBS*currentVert + INF_ATTRIB+2] = z;  //
111 118

  
112
    attribs[VERT_ATTRIBS*currentVert + TEX_ATTRIB  ] = (float)longitude;
113
    attribs[VERT_ATTRIBS*currentVert + TEX_ATTRIB+1] = (float)latitude;
119
    attribs[VERT_ATTRIBS*currentVert + TEX_ATTRIB  ] = (float)texX;
120
    attribs[VERT_ATTRIBS*currentVert + TEX_ATTRIB+1] = (float)texY;
114 121

  
115 122
    currentVert++;
116 123
    }

Also available in: Unified diff