]> git.mxchange.org Git - flightgear.git/commitdiff
Working first pass at material proporty sorting.
authorcurt <curt>
Mon, 8 Jun 1998 17:57:54 +0000 (17:57 +0000)
committercurt <curt>
Mon, 8 Jun 1998 17:57:54 +0000 (17:57 +0000)
Scenery/obj.cxx
Scenery/tile.hxx
Scenery/tilemgr.cxx

index 8a03e2e2e5e2a0c8c06d8eaedddb357c3087a820..4d09c8b1253782302d65a84eb15eec3d59343225 100644 (file)
@@ -110,6 +110,7 @@ int fgObjLoad(char *path, fgTILE *tile) {
     fgFile f;
     int in_fragment, in_faces, ncount, vncount, n1, n2, n3, n4;
     int last1, last2, odd;
+    int i;
 
     o = &current_options;
 
@@ -212,6 +213,14 @@ int fgObjLoad(char *path, fgTILE *tile) {
                (fgMATERIAL *)fragment.material_ptr = &(*myfind).second;
            }
 
+           // initialize the fragment transformation matrix
+           /*
+           for ( i = 0; i < 16; i++ ) {
+               fragment.matrix[i] = 0.0;
+           }
+           fragment.matrix[0] = fragment.matrix[5] =
+               fragment.matrix[10] = fragment.matrix[15] = 1.0;
+           */
        } else if ( line[0] == 't' ) {
            // start a new triangle strip
 
@@ -422,6 +431,9 @@ int fgObjLoad(char *path, fgTILE *tile) {
 
 
 // $Log$
+// Revision 1.12  1998/06/08 17:57:54  curt
+// Working first pass at material proporty sorting.
+//
 // Revision 1.11  1998/06/06 01:09:31  curt
 // I goofed on the log message in the last commit ... now fixed.
 //
index 0ef1b753738c652305725c9c3a6bcaac2b50cf4e..3f4c8d96a10039e3ee08e87f9ea05ec9c1010efc 100644 (file)
@@ -58,6 +58,9 @@ public:
     // variable offset data for this object fragment for this frame
     fgCartesianPoint3d tile_offset;
 
+    // saved transformation matrix for this fragment (used by renderer)
+    // GLfloat matrix[16];
+
     // material property pointer
     void *material_ptr;
 
@@ -102,6 +105,9 @@ public:
 
 
 // $Log$
+// Revision 1.6  1998/06/08 17:57:54  curt
+// Working first pass at material proporty sorting.
+//
 // Revision 1.5  1998/06/06 01:09:32  curt
 // I goofed on the log message in the last commit ... now fixed.
 //
index 5b4b4196498bf3f5b2c8f6541c94c4515e5f7bdf..a97b4cf8faede2314bfc6e979fa2a58fa396e90f 100644 (file)
@@ -305,7 +305,7 @@ void fgTileMgrRender( void ) {
     fgMATERIAL *mtl_ptr;
     list < fgFRAGMENT > :: iterator current;
     list < fgFRAGMENT > :: iterator last;
-    int i, size;
+    int i, j, size;
     int index;
     int culled = 0;
     int drawn = 0;
@@ -367,6 +367,17 @@ void fgTileMgrRender( void ) {
                        frag_ptr->tile_offset.y = t->offset.y;
                        frag_ptr->tile_offset.z = t->offset.z;
 
+                       /*
+                       frag_ptr->matrix[12] = t->offset.x;
+                       frag_ptr->matrix[13] = t->offset.y;
+                       frag_ptr->matrix[14] = t->offset.z;
+
+                       xglGetFloatv(GL_MODELVIEW_MATRIX, frag_ptr->matrix);
+                       for ( j = 1; j < 16; j++ ) {
+                           printf(" a%d = %f\n", j, frag_ptr->matrix[j]);
+                       }
+                       */
+
                        mtl_ptr = (fgMATERIAL *)(frag_ptr->material_ptr);
                        // printf(" lookup = %s\n", mtl_ptr->texture_name);
                        if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
@@ -410,13 +421,14 @@ void fgTileMgrRender( void ) {
     map < string, fgMATERIAL, less<string> > :: iterator maplast = 
        material_mgr.material_map.end();
 
+    xglPushMatrix();
+
     while ( mapcurrent != maplast ) {
         // (char *)key = (*mapcurrent).first;
         // (fgMATERIAL)value = (*mapcurrent).second;
        mtl_ptr = &(*mapcurrent).second;
 
        last_offset.x = last_offset.y = last_offset.z = -99999999.0;
-       xglPushMatrix();
 
        size = mtl_ptr->list_size;
        if ( size > 0 ) {
@@ -436,9 +448,10 @@ void fgTileMgrRender( void ) {
                    // same tile as last time, no transform necessary
                } else {
                    // new tile, new translate
+                   // xglLoadMatrixf( frag_ptr->matrix );
                    xglPopMatrix();
                    xglPushMatrix();
-                   xglTranslatef( frag_ptr->tile_offset.x, 
+                   xglTranslatef( frag_ptr->tile_offset.x,  
                                   frag_ptr->tile_offset.y, 
                                   frag_ptr->tile_offset.z ); 
                }
@@ -459,6 +472,9 @@ void fgTileMgrRender( void ) {
 
 
 // $Log$
+// Revision 1.19  1998/06/08 17:57:54  curt
+// Working first pass at material proporty sorting.
+//
 // Revision 1.18  1998/06/06 01:09:32  curt
 // I goofed on the log message in the last commit ... now fixed.
 //