I already fixed the textures that were broken. Now the cars are visible, and the heads that were missing are also showing (although they have a black texture. I need to check what happened there). The game no longer crashes, and I was able to complete a couple of missions without any issues

This commit is contained in:
Dante Leoncini 2026-05-06 04:33:30 -03:00
parent 6d9929b7ce
commit c2fb268a62
8 changed files with 210 additions and 7 deletions

View file

@ -14,7 +14,7 @@ SOURCE engine.cpp error.cpp frame.cpp geometry.cpp geoplg.cpp
SOURCEPATH ../vendor/librw/src/gl
SOURCE gl3.cpp gl3device.cpp gl3immed.cpp gl3matfx.cpp gl3pipe.cpp gl3raster.cpp gl3render.cpp gl3shader.cpp gl3skin.cpp wdgl.cpp
SOURCEPATH ../vendor/librw/src/gles1
SOURCE gl1.cpp gl1device.cpp gl1immed.cpp gl1pipe.cpp gl1raster.cpp gl1render.cpp
SOURCE gl1.cpp gl1device.cpp gl1immed.cpp gl1matfx.cpp gl1pipe.cpp gl1raster.cpp gl1render.cpp gl1skin.cpp
SOURCEPATH ../vendor/librw/src
SOURCE hanim.cpp image.cpp light.cpp
SOURCEPATH ../vendor/librw/src/lodepng

View file

@ -1033,9 +1033,7 @@ setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extr
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
}
void
flushCache(void)
{
void flushCache(void){
flushGlRenderState();
if(uniformStateDirty[RWGL_ALPHAFUNC] || uniformStateDirty[RWGL_ALPHAREF]){

86
vendor/librw/src/gles1/gl1matfx.cpp vendored Normal file
View file

@ -0,0 +1,86 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "../rwbase.h"
#include "../rwplg.h"
#include "../rwpipeline.h"
#include "../rwobjects.h"
#include "../rwengine.h"
#include "../rwrender.h"
#include "../rwanim.h"
#include "../rwplugins.h"
#include "rwgles1.h"
#include "rwgles1plg.h"
#include "rwgles1impl.h"
#ifdef RW_GLES1
namespace rw {
namespace gles1 {
void
matfxRenderCB(Atomic *atomic, InstanceDataHeader *header)
{
uint32 flags = atomic->geometry->flags;
setWorldMatrix(atomic->getFrame()->getLTM());
glDisable(GL_LIGHTING);
setupVertexInput(header);
InstanceData *inst = header->inst;
int32 n = header->numMeshes;
while(n--){
MatFX *matfx = MatFX::get(inst->material);
Material *m = inst->material;
// En GLES1 sin shaders: ignoramos env map, solo dibujamos textura base
setMaterial(flags, m->color, m->surfaceProps);
setTexture(0, m->texture);
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
drawInst(header, inst);
inst++;
}
teardownVertexInput(header);
}
ObjPipeline*
makeMatFXPipeline(void)
{
ObjPipeline *pipe = ObjPipeline::create();
pipe->instanceCB = defaultInstanceCB;
pipe->uninstanceCB = defaultUninstanceCB;
pipe->renderCB = matfxRenderCB;
pipe->pluginID = ID_MATFX;
pipe->pluginData = 0;
return pipe;
}
static void*
matfxOpen(void *o, int32, int32)
{
matFXGlobals.pipelines[PLATFORM_GLES1] = makeMatFXPipeline();
return o;
}
static void*
matfxClose(void *o, int32, int32)
{
((ObjPipeline*)matFXGlobals.pipelines[PLATFORM_GLES1])->destroy();
matFXGlobals.pipelines[PLATFORM_GLES1] = nil;
return o;
}
void
initMatFX(void)
{
Driver::registerPlugin(PLATFORM_GLES1, 0, ID_MATFX, matfxOpen, matfxClose);
}
}
}
#endif

View file

@ -127,9 +127,7 @@ uninstance(rw::ObjPipeline *rwpipe, Atomic *atomic)
assert(0 && "can't uninstance");
}
static void
render(rw::ObjPipeline *rwpipe, Atomic *atomic)
{
static void render(rw::ObjPipeline *rwpipe, Atomic *atomic){
ObjPipeline *pipe = (ObjPipeline*)rwpipe;
Geometry *geo = atomic->geometry;
pipe->instance(atomic);
@ -137,6 +135,10 @@ render(rw::ObjPipeline *rwpipe, Atomic *atomic)
assert(geo->instData->platform == PLATFORM_GLES1);
if(pipe->renderCB)
pipe->renderCB(atomic, (InstanceDataHeader*)geo->instData);
else {
FILE *f = fopen("E:\\re3_debug.txt", "a");
if(f){ fprintf(f, "render: renderCB is nil!\n"); fclose(f); }
}
}
void

98
vendor/librw/src/gles1/gl1skin.cpp vendored Normal file
View file

@ -0,0 +1,98 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "../rwbase.h"
#include "../rwplg.h"
#include "../rwpipeline.h"
#include "../rwobjects.h"
#include "../rwengine.h"
#include "../rwrender.h"
#include "../rwanim.h"
#include "../rwplugins.h"
#include "rwgles1.h"
#include "rwgles1plg.h"
#include "rwgles1impl.h"
#ifdef RW_GLES1
namespace rw {
namespace gles1 {
void
skinRenderCB(Atomic *atomic, InstanceDataHeader *header)
{
Material *m;
uint32 flags = atomic->geometry->flags;
setWorldMatrix(atomic->getFrame()->getLTM());
glDisable(GL_LIGHTING);
setupVertexInput(header);
InstanceData *inst = header->inst;
int32 n = header->numMeshes;
while(n--){
m = inst->material;
setMaterial(flags, m->color, m->surfaceProps);
setTexture(0, m->texture);
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
drawInst(header, inst);
inst++;
}
teardownVertexInput(header);
}
// skinInstanceCB: igual que defaultInstanceCB, sin pesos/indices
// porque GLES1 no puede hacer skinning en GPU
void
skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance)
{
defaultInstanceCB(geo, header, reinstance);
}
void
skinUninstanceCB(Geometry *geo, InstanceDataHeader *header)
{
assert(0 && "can't uninstance");
}
ObjPipeline*
makeSkinPipeline(void)
{
ObjPipeline *pipe = ObjPipeline::create();
pipe->instanceCB = skinInstanceCB;
pipe->uninstanceCB = skinUninstanceCB;
pipe->renderCB = skinRenderCB;
pipe->pluginID = ID_SKIN;
pipe->pluginData = 1;
return pipe;
}
static void*
skinOpen(void *o, int32, int32)
{
skinGlobals.pipelines[PLATFORM_GLES1] = makeSkinPipeline();
return o;
}
static void*
skinClose(void *o, int32, int32)
{
((ObjPipeline*)skinGlobals.pipelines[PLATFORM_GLES1])->destroy();
skinGlobals.pipelines[PLATFORM_GLES1] = nil;
return o;
}
void
initSkin(void)
{
Driver::registerPlugin(PLATFORM_GLES1, 0, ID_SKIN, skinOpen, skinClose);
}
}
}
#endif

13
vendor/librw/src/gles1/rwgles1plg.h vendored Normal file
View file

@ -0,0 +1,13 @@
namespace rw {
namespace gles1 {
void initMatFX(void);
ObjPipeline *makeMatFXPipeline(void);
void matfxRenderCB(Atomic *atomic, InstanceDataHeader *header);
void initSkin(void);
ObjPipeline *makeSkinPipeline(void);
void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
void skinRenderCB(Atomic *atomic, InstanceDataHeader *header);
void uploadSkinMatrices(Atomic *atomic);
}
}

View file

@ -19,6 +19,8 @@
#include "gl/rwwdgl.h"
#include "gl/rwgl3.h"
#include "gl/rwgl3plg.h"
#include "gles1/rwgles1.h"
#include "gles1/rwgles1plg.h"
#define PLUGIN_ID ID_MATFX
@ -619,6 +621,7 @@ registerMatFXPlugin(void)
d3d9::initMatFX();
wdgl::initMatFX();
gl3::initMatFX();
gles1::initMatFX();
matFXGlobals.atomicOffset =
Atomic::registerPlugin(sizeof(int32), ID_MATFX,

View file

@ -19,6 +19,8 @@
#include "gl/rwwdgl.h"
#include "gl/rwgl3.h"
#include "gl/rwgl3plg.h"
#include "gles1/rwgles1.h"
#include "gles1/rwgles1plg.h"
#define PLUGIN_ID ID_SKIN
@ -373,6 +375,7 @@ registerSkinPlugin(void)
d3d9::initSkin();
wdgl::initSkin();
gl3::initSkin();
gles1::initSkin();
int32 o;
o = Geometry::registerPlugin(sizeof(Skin*), ID_SKIN,