flags in surface class value 0 / 1 bit 0: simple color / flat shading bit 1: gouraud shading bit 2: false mapping bit 3: true mapping bit 4: phong bit 5: specular is off / specular is on bit 6: additive is off / additive is on bit 7: simple sided / double sided bit 8: there is more / there is only than 1 surface / one surface on this object / on this object bit 9: glow is off / glow is on bit 10: not hairy surface / hairy surface bit 11: normal surface / surface has sub-surface(s) bit 12: opaque surface / alpha transparent surface bit 13: surface is in line mode rendering bit 14: for soft only, face is zbuffered bit 15: face is a light ;) #define AF_FLAGS_SCOL 0 #define AF_FLAGS_FLAT 1 #define AF_FLAGS_GOUR 2 #define AF_FLAGS_FMAP 4 #define AF_FLAGS_TMAP 8 #define AF_FLAGS_PHNG 16 #define AF_FLAGS_SPEC 32 #define AF_FLAGS_ADDI 64 #define AF_FLAGS_DSID 128 #define AF_FLAGS_OSRF 256 #define AF_FLAGS_GLOW 512 #define AF_FLAGS_HAIR 1024 #define AF_FLAGS_SUBS 2048 #define AF_FLAGS_ALPH 4096 #define AF_FLAGS_LINE 8192 #define AF_FLAGS_ZBUF 16384 #define AF_FLAGS_LIGH 32768** L init de opengl provoque un "access violation" visible pendant le debug cela dit, aucune instabilitee est a note (??) ** utiliser les bbox pour detecter le z le + grd pour ftri :) ** le tri ca pue, implementer un zbuffer permanent...heu on verrra :) ** implementer la method cullVertex pour le backface ca optimizera :) ** le cas ou une surface est redondante(existe deja dans un autre obj) le flag OSRF :une surface pour tout l objet devient incoherent: possiblement faux ** Matrix knowledge: inverse matrix must be calculated if we want to perform a right inverse transforming, swapping row and column and substract the translations value doesn t work if the matrix is builded with a translation.rotation matrix. I mean if matrix = translationMat.rotate.Mat it doesnt work if matrix = rotateMat.translateMat it work, or object matrix(with pivot) and camera matrix are build as in the first case :( Its because of the matrix mult properties I think: translationMat.rotationMat the result will make a rotation mat with more than a simple add to the [12,13,14] offsets :( ** Faut coder les bounding boxx!!!! et pis un preca ce sertait bien aussi :) ** si les lights sont tjrs dans le bigFace buffer alors rajouter nlight d allocation pour les points .... ** pour les matrices de rotations de normals, pas besion de creer une matrice inverse vu que c est uniquement des rotations, ya po de translations :) void Reduce16to15(short *pScreen) { unsigned long sbatch=(unsigned long)(scene.viewportX*scene.viewportY)/2; __asm { mov esi,sbatch mov edi,pScreen _565to555: mov eax,[edi] add edi,4 mov ebx,eax and eax,11111111110000001111111111000000b and ebx,00000000000111110000000000011111b shr eax,1 or ebx,eax mov [edi-4],ebx dec esi jne short _565to555 } } void scen::transformEntityToCamera( long n ) { float *matrix = entity[n].matrix_ObjectWorld; if( (entity[n].type == 0)) { float *shape = aObject[n].shape3D; struct daPoint **where = new struct daPoint*[aObject[n].nbp]; for(long i=0;ix; bigPoint[nPoint].y = plusVite->y; bigPoint[nPoint++].z = plusVite->z; } } r += ngone; } delete where; } else if( entity[n].type == 3 ) // null object { float *shape = aObject[n].shape3D; // null object is 0,0,0 unique point :) shape[0] = matrix[12]; shape[1] = matrix[13]; shape[2] = matrix[14]; } else if( entity[n].type == 1 ) // see it later... { if( (aLight[n-light_at].type == 0) || (aLight[n-light_at].type == 2)) // distant et spot { } if ( (aLight[n-light_at].type == 0) || (aLight[n-light_at].type == 2) ) { } } } // ----------- FACe normal culling WORKS!! float vO[3], vP[3]; // build viewing vector // from the camera position(worldspace -> object space) // and a vertex(object space) of the face vO[0] = camG[12]; vO[1] = camG[13]; vO[2] = camG[14]; // iVector(vO, entity[n].matrix_ObjectWorld);// transpose to obj space float facevect1x = tshp[br[1]] - tshp[br[0]]; // take first 3 pts float facevect1y = tshp[br[1]+1] - tshp[br[0]+1]; // to form the normal float facevect1z = tshp[br[1]+2] - tshp[br[0]+2]; float facevect2x = tshp[br[2]]- tshp[br[0]]; float facevect2y = tshp[br[2]+1] - tshp[br[0]+1]; float facevect2z = tshp[br[2]+2] - tshp[br[0]+2]; // build normal vector A, B, C plane equation fn[0] = (facevect1y*facevect2z)-(facevect1z*facevect2y); fn[1] = (facevect1z*facevect2x)-(facevect1x*facevect2z); fn[2] = (facevect1x*facevect2y)-(facevect1y*facevect2x); // get normaliz value float nz = dPoint(fn); vP[0]= tshp[br[0]]; vP[1]= tshp[br[0]+1]; vP[2]= tshp[br[0]+2]; // calculate Ax1 + By1 + Cz1 float dst = dot(vP,fn); fn[0] /= nz; fn[1] /= nz; fn[2] /= nz; /* // this transpose a point in world space to a point in object space // using a inverse matrix of camera and object transformations tPoint(vO, iCamG); vO[0] -= entity[n].currentFrame[0]; vO[1] += entity[n].currentFrame[1]; vO[2] -= entity[n].currentFrame[2]; tPoint(vO, entity[n].matrix_IObject); */ // calculate dot product // bigFace[nFace].nx = fn[0]; // bigFace[nFace].ny = fn[1]; // bigFace[nFace].nz = fn[2]; xp = dot(vO,fn); xp += dst; fn+=3; The Visual C++ 6 workspace is in sources/spaceD/Win32 to build the sources you need the opengl sdk and the IMN library (http://xbarr.planet-d.net). The IMN library allow me to read JPEG files :) feedback to gozer@free.fr