mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-22 17:47:20 +03:00
Stub GLES 1.1 backend
This commit is contained in:
parent
f6a5685de8
commit
feefe2e742
28 changed files with 272 additions and 31 deletions
1
vendor/librw/rw.h
vendored
1
vendor/librw/rw.h
vendored
|
|
@ -25,3 +25,4 @@
|
|||
#include "src/gl/rwgl3.h"
|
||||
#include "src/gl/rwgl3shader.h"
|
||||
#include "src/gl/rwgl3plg.h"
|
||||
#include "src/gles1/rwgles1.h"
|
||||
|
|
|
|||
2
vendor/librw/src/base.cpp
vendored
2
vendor/librw/src/base.cpp
vendored
|
|
@ -32,6 +32,8 @@ int32 build = 0xFFFF;
|
|||
int32 platform = PLATFORM_WDGL;
|
||||
#elif RW_GL3
|
||||
int32 platform = PLATFORM_GL3;
|
||||
#elif RW_GLES1
|
||||
int32 platform = PLATFORM_GLES1;
|
||||
#elif RW_D3D9
|
||||
int32 platform = PLATFORM_D3D9;
|
||||
#else
|
||||
|
|
|
|||
1
vendor/librw/src/charset.cpp
vendored
1
vendor/librw/src/charset.cpp
vendored
|
|
@ -12,6 +12,7 @@
|
|||
#include "ps2/rwps2.h"
|
||||
#include "d3d/rwd3d.h"
|
||||
#include "gl/rwgl3.h"
|
||||
#include "gles1/rwgles1.h"
|
||||
|
||||
|
||||
#define PLUGIN_ID 1000 // TODO: find a better ID
|
||||
|
|
|
|||
3
vendor/librw/src/engine.cpp
vendored
3
vendor/librw/src/engine.cpp
vendored
|
|
@ -17,6 +17,7 @@
|
|||
#include "d3d/rwd3d9.h"
|
||||
#include "gl/rwgl3.h"
|
||||
#include "gl/rwwdgl.h"
|
||||
#include "gles1/rwgles1.h"
|
||||
|
||||
#define PLUGIN_ID 0
|
||||
|
||||
|
|
@ -268,6 +269,8 @@ Engine::open(EngineOpenParams *p)
|
|||
engine->device = ps2::renderdevice;
|
||||
#elif RW_GL3
|
||||
engine->device = gl3::renderdevice;
|
||||
//#elif RW_GLES1 // TODO
|
||||
// engine->device = gles1::renderdevice;
|
||||
#elif RW_D3D9
|
||||
engine->device = d3d::renderdevice;
|
||||
#else
|
||||
|
|
|
|||
5
vendor/librw/src/geoplg.cpp
vendored
5
vendor/librw/src/geoplg.cpp
vendored
|
|
@ -18,6 +18,7 @@
|
|||
#include "d3d/rwd3d9.h"
|
||||
#include "gl/rwwdgl.h"
|
||||
#include "gl/rwgl3.h"
|
||||
#include "gles1/rwgles1.h"
|
||||
|
||||
#define PLUGIN_ID 2
|
||||
|
||||
|
|
@ -251,6 +252,10 @@ destroyNativeData(void *object, int32 offset, int32 size)
|
|||
return d3d9::destroyNativeData(object, offset, size);
|
||||
if(geometry->instData->platform == PLATFORM_GL3)
|
||||
return gl3::destroyNativeData(object, offset, size);
|
||||
#ifdef RW_GLES1
|
||||
if(geometry->instData->platform == PLATFORM_GLES1)
|
||||
return gles1::destroyNativeData(object, offset, size);
|
||||
#endif
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
|
|||
58
vendor/librw/src/gles1/rwgles1.cpp
vendored
Normal file
58
vendor/librw/src/gles1/rwgles1.cpp
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "rwgles1.h"
|
||||
|
||||
#ifdef RW_GLES1
|
||||
|
||||
namespace rw {
|
||||
|
||||
namespace gles1 {
|
||||
|
||||
// --- Funciones dummy (para linkear después) ---
|
||||
|
||||
inline void im2DRenderPrimitive(int, void*, int) {}
|
||||
inline void im2DRenderIndexedPrimitive(int, void*, int, void*, int) {}
|
||||
inline void im3DTransform(void*, int, void*, unsigned int) {}
|
||||
inline void im3DRenderPrimitive(int) {}
|
||||
inline void im3DRenderIndexedPrimitive(int, void*, int) {}
|
||||
inline void im3DEnd(void) {}
|
||||
|
||||
// --- Driver lifecycle ---
|
||||
static void*
|
||||
driverOpen(void* object, int32 offset, int32 size)
|
||||
{
|
||||
// stub: no hace nada
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
driverClose(void* object, int32 offset, int32 size)
|
||||
{
|
||||
// stub: no hace nada
|
||||
return object;
|
||||
}
|
||||
|
||||
// --- Raster ---
|
||||
static void
|
||||
registerNativeRaster(void)
|
||||
{
|
||||
// stub por ahora
|
||||
}
|
||||
|
||||
void
|
||||
registerPlatformPlugins(void)
|
||||
{
|
||||
Driver::registerPlugin(PLATFORM_GLES1, 0, PLATFORM_GLES1,
|
||||
driverOpen, driverClose);
|
||||
registerNativeRaster();
|
||||
}
|
||||
|
||||
void*
|
||||
destroyNativeData(void *object, int32, int32)
|
||||
{
|
||||
//freeInstanceData((Geometry*)object);
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
108
vendor/librw/src/gles1/rwgles1.h
vendored
Normal file
108
vendor/librw/src/gles1/rwgles1.h
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "../rwbase.h"
|
||||
#include "../rwerror.h"
|
||||
#include "../rwplg.h"
|
||||
#include "../rwpipeline.h"
|
||||
#include "../rwobjects.h"
|
||||
#include "../rwengine.h"
|
||||
|
||||
#ifdef RW_GLES1
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/egl.h>
|
||||
#ifdef __SYMBIAN32__
|
||||
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace rw {
|
||||
|
||||
#ifdef RW_GLES1
|
||||
struct EngineOpenParams
|
||||
{
|
||||
int width, height;
|
||||
const char *windowtitle;
|
||||
};
|
||||
#endif
|
||||
|
||||
namespace gles1 {
|
||||
|
||||
// --- Tipos básicos que charset.cpp y otros esperan ---
|
||||
|
||||
struct Im2DVertex {
|
||||
float x, y, z, w;
|
||||
float camZ;
|
||||
float recipCamZ;
|
||||
unsigned char r, g, b, a;
|
||||
float u, v;
|
||||
|
||||
// --- setters esperados por librw ---
|
||||
|
||||
void setScreenX(float v) { x = v; }
|
||||
void setScreenY(float v) { y = v; }
|
||||
void setScreenZ(float v) { z = v; }
|
||||
|
||||
void setCameraZ(float v) { camZ = v; }
|
||||
void setRecipCameraZ(float v) { recipCamZ = v; }
|
||||
|
||||
void setColor(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a) {
|
||||
r = _r; g = _g; b = _b; a = _a;
|
||||
}
|
||||
|
||||
void setU(float val, float recipZ) { u = val; }
|
||||
void setV(float val, float recipZ) { v = val; }
|
||||
};
|
||||
|
||||
struct Im3DVertex {
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
uint32 color;
|
||||
|
||||
void setX(float v) { x = v; }
|
||||
void setY(float v) { y = v; }
|
||||
void setZ(float v) { z = v; }
|
||||
|
||||
void setU(float v) { u = v; }
|
||||
void setV(float v) { this->v = v; }
|
||||
|
||||
void setColor(uint8 r, uint8 g, uint8 b, uint8 a) {
|
||||
color = (a<<24) | (r<<16) | (g<<8) | b;
|
||||
}
|
||||
};
|
||||
|
||||
// --- Funciones dummy (para linkear después) ---
|
||||
|
||||
inline void im2DRenderPrimitive(int, void*, int);
|
||||
inline void im2DRenderIndexedPrimitive(int, void*, int, void*, int);
|
||||
inline void im3DTransform(void*, int, void*, unsigned int);
|
||||
inline void im3DRenderPrimitive(int);
|
||||
inline void im3DRenderIndexedPrimitive(int, void*, int);
|
||||
inline void im3DEnd(void);
|
||||
|
||||
// --- Driver lifecycle ---
|
||||
static void*
|
||||
driverOpen(void* object, int32 offset, int32 size);
|
||||
|
||||
static void*
|
||||
driverClose(void* object, int32 offset, int32 size);
|
||||
|
||||
// --- Raster ---
|
||||
static void
|
||||
registerNativeRaster(void);
|
||||
|
||||
void registerPlatformPlugins(void);
|
||||
|
||||
void *destroyNativeData(void *object, int32, int32);
|
||||
|
||||
}
|
||||
}
|
||||
7
vendor/librw/src/rwbase.h
vendored
7
vendor/librw/src/rwbase.h
vendored
|
|
@ -9,6 +9,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#undef stderr
|
||||
#define stderr stdout
|
||||
#endif
|
||||
|
||||
|
|
@ -46,6 +47,11 @@
|
|||
#define RW_OPENGL
|
||||
#endif
|
||||
|
||||
#ifdef RW_GLES1
|
||||
//#define RW_OPENGL
|
||||
#define RWDEVICE gles1
|
||||
#endif
|
||||
|
||||
namespace rw {
|
||||
|
||||
#ifdef RW_PS2
|
||||
|
|
@ -546,6 +552,7 @@ enum Platform
|
|||
|
||||
PLATFORM_WDGL = 11, // WarDrum OpenGL
|
||||
PLATFORM_GL3 = 12, // my GL3 implementation
|
||||
PLATFORM_GLES1 = 13,
|
||||
|
||||
NUM_PLATFORMS,
|
||||
|
||||
|
|
|
|||
12
vendor/librw/src/texture.cpp
vendored
12
vendor/librw/src/texture.cpp
vendored
|
|
@ -481,6 +481,10 @@ Texture::streamReadNative(Stream *stream)
|
|||
return xbox::readNativeTexture(stream);
|
||||
if(platform == PLATFORM_GL3)
|
||||
return gl3::readNativeTexture(stream);
|
||||
#ifdef RW_GLES1
|
||||
// if(platform == PLATFORM_GLES1) // TODO
|
||||
// return gles1::readNativeTexture(stream);
|
||||
#endif
|
||||
assert(0 && "unsupported platform");
|
||||
return nil;
|
||||
}
|
||||
|
|
@ -498,6 +502,10 @@ Texture::streamWriteNative(Stream *stream)
|
|||
xbox::writeNativeTexture(this, stream);
|
||||
else if(this->raster->platform == PLATFORM_GL3)
|
||||
gl3::writeNativeTexture(this, stream);
|
||||
#ifdef RW_GLES1
|
||||
// else if(this->raster->platform == PLATFORM_GLES1)
|
||||
// gles1::writeNativeTexture(this, stream);
|
||||
#endif
|
||||
else
|
||||
assert(0 && "unsupported platform");
|
||||
}
|
||||
|
|
@ -515,6 +523,10 @@ Texture::streamGetSizeNative(void)
|
|||
return xbox::getSizeNativeTexture(this);
|
||||
if(this->raster->platform == PLATFORM_GL3)
|
||||
return gl3::getSizeNativeTexture(this);
|
||||
#ifdef RW_GLES1
|
||||
// if(this->raster->platform == PLATFORM_GLES1)
|
||||
// return gles1::getSizeNativeTexture(this);
|
||||
#endif
|
||||
assert(0 && "unsupported platform");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue