Working first pass at material proporty sorting.
This commit is contained in:
parent
b4e53ba51d
commit
a6c7336cad
3 changed files with 37 additions and 3 deletions
|
@ -110,6 +110,7 @@ int fgObjLoad(char *path, fgTILE *tile) {
|
||||||
fgFile f;
|
fgFile f;
|
||||||
int in_fragment, in_faces, ncount, vncount, n1, n2, n3, n4;
|
int in_fragment, in_faces, ncount, vncount, n1, n2, n3, n4;
|
||||||
int last1, last2, odd;
|
int last1, last2, odd;
|
||||||
|
int i;
|
||||||
|
|
||||||
o = ¤t_options;
|
o = ¤t_options;
|
||||||
|
|
||||||
|
@ -212,6 +213,14 @@ int fgObjLoad(char *path, fgTILE *tile) {
|
||||||
(fgMATERIAL *)fragment.material_ptr = &(*myfind).second;
|
(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' ) {
|
} else if ( line[0] == 't' ) {
|
||||||
// start a new triangle strip
|
// start a new triangle strip
|
||||||
|
|
||||||
|
@ -422,6 +431,9 @@ int fgObjLoad(char *path, fgTILE *tile) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.11 1998/06/06 01:09:31 curt
|
||||||
// I goofed on the log message in the last commit ... now fixed.
|
// I goofed on the log message in the last commit ... now fixed.
|
||||||
//
|
//
|
||||||
|
|
|
@ -58,6 +58,9 @@ public:
|
||||||
// variable offset data for this object fragment for this frame
|
// variable offset data for this object fragment for this frame
|
||||||
fgCartesianPoint3d tile_offset;
|
fgCartesianPoint3d tile_offset;
|
||||||
|
|
||||||
|
// saved transformation matrix for this fragment (used by renderer)
|
||||||
|
// GLfloat matrix[16];
|
||||||
|
|
||||||
// material property pointer
|
// material property pointer
|
||||||
void *material_ptr;
|
void *material_ptr;
|
||||||
|
|
||||||
|
@ -102,6 +105,9 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.5 1998/06/06 01:09:32 curt
|
||||||
// I goofed on the log message in the last commit ... now fixed.
|
// I goofed on the log message in the last commit ... now fixed.
|
||||||
//
|
//
|
||||||
|
|
|
@ -305,7 +305,7 @@ void fgTileMgrRender( void ) {
|
||||||
fgMATERIAL *mtl_ptr;
|
fgMATERIAL *mtl_ptr;
|
||||||
list < fgFRAGMENT > :: iterator current;
|
list < fgFRAGMENT > :: iterator current;
|
||||||
list < fgFRAGMENT > :: iterator last;
|
list < fgFRAGMENT > :: iterator last;
|
||||||
int i, size;
|
int i, j, size;
|
||||||
int index;
|
int index;
|
||||||
int culled = 0;
|
int culled = 0;
|
||||||
int drawn = 0;
|
int drawn = 0;
|
||||||
|
@ -367,6 +367,17 @@ void fgTileMgrRender( void ) {
|
||||||
frag_ptr->tile_offset.y = t->offset.y;
|
frag_ptr->tile_offset.y = t->offset.y;
|
||||||
frag_ptr->tile_offset.z = t->offset.z;
|
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);
|
mtl_ptr = (fgMATERIAL *)(frag_ptr->material_ptr);
|
||||||
// printf(" lookup = %s\n", mtl_ptr->texture_name);
|
// printf(" lookup = %s\n", mtl_ptr->texture_name);
|
||||||
if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
|
if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
|
||||||
|
@ -410,13 +421,14 @@ void fgTileMgrRender( void ) {
|
||||||
map < string, fgMATERIAL, less<string> > :: iterator maplast =
|
map < string, fgMATERIAL, less<string> > :: iterator maplast =
|
||||||
material_mgr.material_map.end();
|
material_mgr.material_map.end();
|
||||||
|
|
||||||
|
xglPushMatrix();
|
||||||
|
|
||||||
while ( mapcurrent != maplast ) {
|
while ( mapcurrent != maplast ) {
|
||||||
// (char *)key = (*mapcurrent).first;
|
// (char *)key = (*mapcurrent).first;
|
||||||
// (fgMATERIAL)value = (*mapcurrent).second;
|
// (fgMATERIAL)value = (*mapcurrent).second;
|
||||||
mtl_ptr = &(*mapcurrent).second;
|
mtl_ptr = &(*mapcurrent).second;
|
||||||
|
|
||||||
last_offset.x = last_offset.y = last_offset.z = -99999999.0;
|
last_offset.x = last_offset.y = last_offset.z = -99999999.0;
|
||||||
xglPushMatrix();
|
|
||||||
|
|
||||||
size = mtl_ptr->list_size;
|
size = mtl_ptr->list_size;
|
||||||
if ( size > 0 ) {
|
if ( size > 0 ) {
|
||||||
|
@ -436,9 +448,10 @@ void fgTileMgrRender( void ) {
|
||||||
// same tile as last time, no transform necessary
|
// same tile as last time, no transform necessary
|
||||||
} else {
|
} else {
|
||||||
// new tile, new translate
|
// new tile, new translate
|
||||||
|
// xglLoadMatrixf( frag_ptr->matrix );
|
||||||
xglPopMatrix();
|
xglPopMatrix();
|
||||||
xglPushMatrix();
|
xglPushMatrix();
|
||||||
xglTranslatef( frag_ptr->tile_offset.x,
|
xglTranslatef( frag_ptr->tile_offset.x,
|
||||||
frag_ptr->tile_offset.y,
|
frag_ptr->tile_offset.y,
|
||||||
frag_ptr->tile_offset.z );
|
frag_ptr->tile_offset.z );
|
||||||
}
|
}
|
||||||
|
@ -459,6 +472,9 @@ void fgTileMgrRender( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $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
|
// Revision 1.18 1998/06/06 01:09:32 curt
|
||||||
// I goofed on the log message in the last commit ... now fixed.
|
// I goofed on the log message in the last commit ... now fixed.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue