the need for "void" pointers and casts.
Quick hack to count the number of scenery polygons that are being drawn.
sscanf(line, "usemtl %s\n", material);
// give the fragment a pointer back to the tile
- (fgTILE *)(fragment.tile_ptr) = t;
+ fragment.tile_ptr = t;
// find this material in the properties list
map < string, fgMATERIAL, less<string> > :: iterator myfind =
"Ack! unknown usemtl name = %s in %s\n",
material, path);
} else {
- fragment.material_ptr = (void *)(&(*myfind).second);
+ fragment.material_ptr = &(*myfind).second;
}
// initialize the fragment transformation matrix
// $Log$
+// Revision 1.22 1998/08/20 15:12:03 curt
+// Used a forward declaration of classes fgTILE and fgMATERIAL to eliminate
+// the need for "void" pointers and casts.
+// Quick hack to count the number of scenery polygons that are being drawn.
+//
// Revision 1.21 1998/08/12 21:13:04 curt
// material.cxx: don't load textures if they are disabled
// obj.cxx: optimizations from Norman Vine
/* texload is a simplistic routine for reading an SGI .rgb image file. */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_WINDOWS_H
+# include <windows.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
list < fgFACE > :: iterator last;
// find the associated tile
- t = (fgTILE *)tile_ptr;
+ t = tile_ptr;
// printf("Intersecting\n");
// $Log$
+// Revision 1.7 1998/08/20 15:12:05 curt
+// Used a forward declaration of classes fgTILE and fgMATERIAL to eliminate
+// the need for "void" pointers and casts.
+// Quick hack to count the number of scenery polygons that are being drawn.
+//
// Revision 1.6 1998/08/12 21:13:05 curt
// material.cxx: don't load textures if they are disabled
// obj.cxx: optimizations from Norman Vine
#define MAX_NODES 1000
+// Forward declarations
+class fgTILE;
+class fgMATERIAL;
+
+
class fgFACE {
public:
int n1, n2, n3;
// material property this fragment is assigned to.
// material property pointer
- void *material_ptr;
+ fgMATERIAL *material_ptr;
// tile pointer
- void *tile_ptr;
+ fgTILE *tile_ptr;
// OpenGL display list for fragment data
GLint display_list;
// $Log$
+// Revision 1.15 1998/08/20 15:12:06 curt
+// Used a forward declaration of classes fgTILE and fgMATERIAL to eliminate
+// the need for "void" pointers and casts.
+// Quick hack to count the number of scenery polygons that are being drawn.
+//
// Revision 1.14 1998/08/12 21:13:06 curt
// material.cxx: don't load textures if they are disabled
// obj.cxx: optimizations from Norman Vine
int index;
int culled = 0;
int drawn = 0;
+ int total_faces = 0;
c = &global_tile_cache;
f = current_aircraft.flight;
// frag_ptr->tile_offset.y = t->offset.y;
// frag_ptr->tile_offset.z = t->offset.z;
- mtl_ptr = (fgMATERIAL *)(frag_ptr->material_ptr);
+ mtl_ptr = frag_ptr->material_ptr;
// printf(" lookup = %s\n", mtl_ptr->texture_name);
if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
mtl_ptr->list[mtl_ptr->list_size] = frag_ptr;
for ( i = 0; i < size; i++ ) {
frag_ptr = mtl_ptr->list[i];
+ // count up the number of polygons we are drawing in
+ // case someone is interested.
+ total_faces += frag_ptr->num_faces;
+
if ( frag_ptr->tile_ptr == last_tile_ptr ) {
// same tile as last time, no transform necessary
} else {
// new tile, new translate
// xglLoadMatrixf( frag_ptr->matrix );
- t = (fgTILE *)(frag_ptr->tile_ptr);
+ t = frag_ptr->tile_ptr;
xglLoadMatrixd(t->model_view );
}
// printf(" display_list = %d\n", frag_ptr->display_list);
xglCallList(frag_ptr->display_list);
- last_tile_ptr = (fgTILE *)(frag_ptr->tile_ptr);
+ last_tile_ptr = frag_ptr->tile_ptr;
}
}
}
xglPopMatrix();
+
+ fgPrintf( FG_TERRAIN, FG_DEBUG, "Rendered %d polygons this frame.\n",
+ total_faces);
}
// $Log$
+// Revision 1.29 1998/08/20 15:12:06 curt
+// Used a forward declaration of classes fgTILE and fgMATERIAL to eliminate
+// the need for "void" pointers and casts.
+// Quick hack to count the number of scenery polygons that are being drawn.
+//
// Revision 1.28 1998/08/12 21:13:06 curt
// material.cxx: don't load textures if they are disabled
// obj.cxx: optimizations from Norman Vine