MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ReadFromDemoFile

Method ReadFromDemoFile

neo/renderer/Model.cpp:2156–2195  ·  view source on GitHub ↗

================ idRenderModelStatic::ReadFromDemoFile ================ */

Source from the content-addressed store, hash-verified

2154================
2155*/
2156void idRenderModelStatic::ReadFromDemoFile( class idDemoFile *f ) {
2157 PurgeModel();
2158
2159 InitEmpty( f->ReadHashString() );
2160
2161 int i, j, numSurfaces;
2162 f->ReadInt( numSurfaces );
2163
2164 for ( i = 0 ; i < numSurfaces ; i++ ) {
2165 modelSurface_t surf;
2166
2167 surf.shader = declManager->FindMaterial( f->ReadHashString() );
2168
2169 srfTriangles_t *tri = R_AllocStaticTriSurf();
2170
2171 f->ReadInt( tri->numIndexes );
2172 R_AllocStaticTriSurfIndexes( tri, tri->numIndexes );
2173 for ( j = 0; j < tri->numIndexes; ++j )
2174 f->ReadInt( (int&)tri->indexes[j] );
2175
2176 f->ReadInt( tri->numVerts );
2177 R_AllocStaticTriSurfVerts( tri, tri->numVerts );
2178 for ( j = 0; j < tri->numVerts; ++j ) {
2179 f->ReadVec3( tri->verts[j].xyz );
2180 f->ReadVec2( tri->verts[j].st );
2181 f->ReadVec3( tri->verts[j].normal );
2182 f->ReadVec3( tri->verts[j].tangents[0] );
2183 f->ReadVec3( tri->verts[j].tangents[1] );
2184 f->ReadUnsignedChar( tri->verts[j].color[0] );
2185 f->ReadUnsignedChar( tri->verts[j].color[1] );
2186 f->ReadUnsignedChar( tri->verts[j].color[2] );
2187 f->ReadUnsignedChar( tri->verts[j].color[3] );
2188 }
2189
2190 surf.geometry = tri;
2191
2192 this->AddSurface( surf );
2193 }
2194 this->FinishSurfaces();
2195}
2196
2197/*
2198================

Callers 2

ProcessDemoCommandMethod · 0.45
ReadRenderEntityMethod · 0.45

Calls 11

AddSurfaceMethod · 0.95
FinishSurfacesMethod · 0.95
R_AllocStaticTriSurfFunction · 0.85
ReadHashStringMethod · 0.80
ReadUnsignedCharMethod · 0.80
ReadIntMethod · 0.45
FindMaterialMethod · 0.45
ReadVec3Method · 0.45
ReadVec2Method · 0.45

Tested by

no test coverage detected