For this to work the 2D mode has to be properly set and unset at the right places so that no double mapping occurs and no render operation can happen while in 2D mode.
# Conflicts:
# src/d_main.cpp
# src/v_video.h
Pass surf->vbStart to SetupFrame instead of 0, and pass 0 to DrawArrays instead of surf->vbStart.
Use a potentially faster method of modifying the OBJ file text buffer by modifying it directly.
Add RealignVector and FixUV methods to begin work on re-aligning OBJ models to the same orientation as MD3 models.
Re-align OBJ models to match MD3 models
Fix normal calculation for re-aligned OBJs
Ensure AddSkins does not go out of bounds of surfaceskinIDs
Do not precache skins that were replaced by the user.
Fix OBJs with a large number of materials not being fully rendered
Print a warning message if a material referenced by the OBJ could not be found.
Free surface triangles once they are no longer needed
Also, use continue instead of return so that surfaces after those with missing materials are still rendered.
Fail if a face side has no vertex reference. Vertex references are required for a valid OBJ.
Clean up OBJ model code
Remove commented code, mainly Printf's that aren't used any more.
Add more documentation comments, and tweak existing documentation comments
Replace ParseVector2 and ParseVector3 with a template ParseVector function
Create a new surface for each 'usemtl' statement in the OBJ file, and fix memory errors caused by TriangulateQuad.
Calculate missing normals, and fix incorrect UV coordinates
Fix construction of vertex buffer for objects with multiple surfaces
Localize curMtl, curSurface, aggSurfFaceCount, and curSurfFaceCount to FOBJModel::Load(), since they are not used anywhere else.
Fix parsing of OBJs without UV references
Internally, I replaced hashtag line comments with C-style line comments, and I replaced each forward slash with newSideSep.
If no UV coordinates are available, add a default vector of (0,0).
Also, remove "this->" from ResolveIndex to make the code a bit cleaner, and fix a minor garbage issue I failed to notice earlier (normref would pick up garbage if there was no normal reference).
Ensure usemtl statements remain intact
It may be a bit inefficient, but I tried modifying the buffer directly, and I got memory corruption errors. In this case, it's a lot better to be safe than sorry.
What works:
- Parsing the model
- Constructing geometry (surfaces) for triangulated models
What doesn't:
- Rendering the model
- Building the vertex buffer
- Triangulating quads
RIndexOf returns the index where the substring starts, instead of the index where the substring ends - 1.
Deprecate the LastIndexOf method of StringStruct
This setup has been a constant source of problems so now I reviewed all uses of FName to make sure that everything that needs to be initialized is done manually.
This also merges the player_t constructor into the class definition as default values.