29 #include "../idlib/precompiled.h"
53 for ( i = 0; i <
materials[k]->surfaces.Num(); i++ ) {
86 if ( surface->
verts ) {
105 int i, maxVerts, maxIndexes, surfNum;
111 for ( surfNum = 0; surfNum < model->
NumSurfaces(); surfNum++ ) {
123 glIndex_t *overlayIndexes = (
glIndex_t *)_alloca16( maxIndexes *
sizeof( *overlayIndexes ) );
143 if ( d < 0.0f || d > 1.0
f ) {
149 if ( d < 0.0f || d > 1.0f ) {
153 byte *cullBits = (
byte *)_alloca16( stri->
numVerts *
sizeof( cullBits[0] ) );
171 if ( cullBits[v1] & cullBits[v2] & cullBits[v3] ) {
178 for (
int vnum = 0; vnum < 3; vnum++ ) {
180 if ( vertexRemap[ind] == (
glIndex_t)-1 ) {
181 vertexRemap[ind] = numVerts;
184 overlayVerts[numVerts].
st[0] = texCoords[ind][0];
185 overlayVerts[numVerts].
st[1] = texCoords[ind][1];
189 overlayIndexes[numIndexes++] = vertexRemap[ind];
201 memcpy( s->
verts, overlayVerts, numVerts *
sizeof( s->
verts[0] ) );
204 memcpy( s->
indexes, overlayIndexes, numIndexes *
sizeof( s->
indexes[0] ) );
207 for ( i = 0; i <
materials.Num(); i++ ) {
223 for ( i = 0; i <
materials.Num(); i++ ) {
237 int i,
j, k, numVerts, numIndexes, surfaceNum;
254 common->
Error(
"idRenderModelOverlay::AddOverlaySurfacesToModel: baseModel is not a static model" );
257 assert( dynamic_cast<idRenderModelStatic *>(baseModel) !=
NULL );
267 for ( k = 0; k <
materials.Num(); k++ ) {
269 numVerts = numIndexes = 0;
270 for ( i = 0; i <
materials[k]->surfaces.Num(); i++ ) {
271 numVerts +=
materials[k]->surfaces[
i]->numVerts;
272 numIndexes +=
materials[k]->surfaces[
i]->numIndexes;
276 newSurf = &staticModel->
surfaces[surfaceNum];
278 newSurf = &staticModel->
surfaces.Alloc();
281 newSurf->
id = -1 - k;
295 numVerts = numIndexes = 0;
297 for ( i = 0; i <
materials[k]->surfaces.Num(); i++ ) {
308 if ( !baseSurf || baseSurf->
id != surf->
surfaceId ) {
328 for ( j = 0; j < surf->
numVerts; j++ ) {
331 newTri->
verts[numVerts].
st[0] = overlayVert->
st[0];
332 newTri->
verts[numVerts].
st[1] = overlayVert->
st[1];
336 common->
Warning(
"idRenderModelOverlay::AddOverlaySurfacesToModel: overlay vertex out of range. Model has probably changed since generating the overlay." );
363 assert( dynamic_cast<idRenderModelStatic *>(baseModel) !=
NULL );
static void RemoveOverlaySurfacesFromModel(idRenderModel *baseModel)
bool FindSurfaceWithId(int id, int &surfaceNum)
idList< modelSurface_t > surfaces
assert(prefInfo.fullscreenBtn)
struct overlayMaterial_s overlayMaterial_t
virtual const modelSurface_t * Surface(int surfaceNum) const
const idMaterial * shader
virtual void VPCALL OverlayPointCull(byte *cullBits, idVec2 *texCoords, const idPlane *planes, const idDrawVert *verts, const int numVerts)=0
srfTriangles_t * R_AllocStaticTriSurf(void)
virtual void VPCALL Memset(void *dst, const int val, const int count)=0
bool DeleteSurfaceWithId(int id)
void FreeSurface(overlaySurface_t *surface)
static void Free(idRenderModelOverlay *overlay)
virtual dynamicModel_t IsDynamicModel() const =0
static idRenderModelOverlay * Alloc(void)
bool AllowOverlays(void) const
const idMaterial * material
GLfloat GLfloat GLfloat v2
void CreateOverlay(const idRenderModel *model, const idPlane localTextureAxis[2], const idMaterial *material)
void DeleteSurfacesWithNegativeId(void)
float PlaneDistance(const idPlane &plane) const
srfTriangles_t * geometry
virtual const modelSurface_t * Surface(int surfaceNum) const =0
void R_FreeStaticTriSurf(srfTriangles_t *tri)
void R_BoundTriSurf(srfTriangles_t *tri)
GLfloat GLfloat GLfloat GLfloat v3
virtual bool IsDefaultModel() const =0
virtual int NumBaseSurfaces() const =0
const int MAX_OVERLAY_SURFACES
idList< overlaySurface_t * > surfaces
virtual int NumSurfaces() const
void AddOverlaySurfacesToModel(idRenderModel *baseModel)
idList< overlayMaterial_t * > materials
void R_AllocStaticTriSurfIndexes(srfTriangles_t *tri, int numIndexes)
void * Mem_Alloc(const int size)
virtual void Error(const char *fmt,...) id_attribute((format(printf
void R_AllocStaticTriSurfVerts(srfTriangles_t *tri, int numVerts)
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
void WriteToDemoFile(class idDemoFile *f) const
void R_FreeStaticTriSurfVertexCaches(srfTriangles_t *tri)
void ReadFromDemoFile(class idDemoFile *f)
idSIMDProcessor * SIMDProcessor
virtual int NumSurfaces() const =0