mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-15 17:44:25 +02:00
remove API-specific code from Core
This commit is contained in:
225
src/core.h
225
src/core.h
@@ -11,16 +11,11 @@
|
|||||||
#define OS_PTHREAD_MT
|
#define OS_PTHREAD_MT
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define _OS_WINDOWS
|
#define _OS_WIN
|
||||||
#define _GAPI_GL
|
#define _GAPI_GL
|
||||||
//#define _GAPI_VULKAN
|
//#define _GAPI_VULKAN
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef _GAPI_GL
|
|
||||||
#include <gl/GL.h>
|
|
||||||
#include <gl/glext.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef OS_PTHREAD_MT
|
#undef OS_PTHREAD_MT
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
@@ -29,89 +24,16 @@
|
|||||||
#define _GAPI_GLES
|
#define _GAPI_GLES
|
||||||
//#define _GAPI_VULKAN
|
//#define _GAPI_VULKAN
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#ifdef _GAPI_GL
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#include <GLES2/gl2ext.h>
|
|
||||||
#define GL_CLAMP_TO_BORDER 0x812D
|
|
||||||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
|
||||||
|
|
||||||
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
|
||||||
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
|
||||||
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
|
||||||
|
|
||||||
#define GL_RGBA16F 0x881A
|
|
||||||
#define GL_RGBA32F 0x8814
|
|
||||||
#define GL_HALF_FLOAT 0x140B
|
|
||||||
|
|
||||||
#define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
|
|
||||||
#define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
|
|
||||||
|
|
||||||
#define PFNGLGENVERTEXARRAYSPROC PFNGLGENVERTEXARRAYSOESPROC
|
|
||||||
#define PFNGLDELETEVERTEXARRAYSPROC PFNGLDELETEVERTEXARRAYSOESPROC
|
|
||||||
#define PFNGLBINDVERTEXARRAYPROC PFNGLBINDVERTEXARRAYOESPROC
|
|
||||||
#define glGenVertexArrays glGenVertexArraysOES
|
|
||||||
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
|
||||||
#define glBindVertexArray glBindVertexArrayOES
|
|
||||||
|
|
||||||
#define PFNGLGETPROGRAMBINARYPROC PFNGLGETPROGRAMBINARYOESPROC
|
|
||||||
#define PFNGLPROGRAMBINARYPROC PFNGLPROGRAMBINARYOESPROC
|
|
||||||
#define glGetProgramBinary glGetProgramBinaryOES
|
|
||||||
#define glProgramBinary glProgramBinaryOES
|
|
||||||
|
|
||||||
#define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void osToggleVR(bool enable);
|
extern void osToggleVR(bool enable);
|
||||||
#elif __RPI__
|
#elif __RPI__
|
||||||
#define _OS_RPI
|
#define _OS_RPI
|
||||||
#define _GAPI_GL
|
#define _GAPI_GL
|
||||||
#define _GAPI_GLES
|
#define _GAPI_GLES
|
||||||
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#include <GLES2/gl2ext.h>
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <EGL/eglext.h>
|
|
||||||
|
|
||||||
#define GL_CLAMP_TO_BORDER 0x812D
|
|
||||||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
|
||||||
|
|
||||||
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
|
||||||
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
|
||||||
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
|
||||||
|
|
||||||
#undef GL_RGBA32F
|
|
||||||
#undef GL_RGBA16F
|
|
||||||
#undef GL_HALF_FLOAT
|
|
||||||
|
|
||||||
#define GL_RGBA32F GL_RGBA
|
|
||||||
#define GL_RGBA16F GL_RGBA
|
|
||||||
#define GL_HALF_FLOAT GL_HALF_FLOAT_OES
|
|
||||||
|
|
||||||
#define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
|
|
||||||
#define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
|
|
||||||
|
|
||||||
#define glGenVertexArrays(...)
|
|
||||||
#define glDeleteVertexArrays(...)
|
|
||||||
#define glBindVertexArray(...)
|
|
||||||
|
|
||||||
#define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
|
|
||||||
#define glGetProgramBinary(...)
|
|
||||||
#define glProgramBinary(...)
|
|
||||||
|
|
||||||
extern EGLDisplay display;
|
|
||||||
|
|
||||||
#define DYNGEOM_NO_VBO
|
#define DYNGEOM_NO_VBO
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
#define _OS_LINUX
|
#define _OS_LINUX
|
||||||
#define _GAPI_GL
|
#define _GAPI_GL
|
||||||
|
|
||||||
#ifdef _GAPI_GL
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#endif
|
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
#define _GAPI_GL
|
#define _GAPI_GL
|
||||||
#include "TargetConditionals.h"
|
#include "TargetConditionals.h"
|
||||||
@@ -119,73 +41,18 @@
|
|||||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||||
#define _OS_IOS
|
#define _OS_IOS
|
||||||
#define _GAPI_GLES
|
#define _GAPI_GLES
|
||||||
|
|
||||||
#include <OpenGLES/ES2/gl.h>
|
|
||||||
#include <OpenGLES/ES2/glext.h>
|
|
||||||
#include <OpenGLES/ES3/glext.h>
|
|
||||||
|
|
||||||
#define PFNGLGENVERTEXARRAYSPROC PFNGLGENVERTEXARRAYSOESPROC
|
|
||||||
#define PFNGLDELETEVERTEXARRAYSPROC PFNGLDELETEVERTEXARRAYSOESPROC
|
|
||||||
#define PFNGLBINDVERTEXARRAYPROC PFNGLBINDVERTEXARRAYOESPROC
|
|
||||||
#define glGenVertexArrays glGenVertexArraysOES
|
|
||||||
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
|
||||||
#define glBindVertexArray glBindVertexArrayOES
|
|
||||||
|
|
||||||
#define GL_CLAMP_TO_BORDER 0x812D
|
|
||||||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
|
||||||
|
|
||||||
#define GL_TEXTURE_COMPARE_MODE GL_TEXTURE_COMPARE_MODE_EXT
|
|
||||||
#define GL_TEXTURE_COMPARE_FUNC GL_TEXTURE_COMPARE_FUNC_EXT
|
|
||||||
#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_REF_TO_TEXTURE_EXT
|
|
||||||
#else
|
#else
|
||||||
#define _OS_MACOS
|
#define _OS_MAC
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#include <AudioToolbox/AudioQueue.h>
|
|
||||||
#include <OpenGL/OpenGL.h>
|
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#include <OpenGL/glext.h>
|
|
||||||
#include <AGL/agl.h>
|
|
||||||
|
|
||||||
#define GL_RGBA16F 0x881A
|
|
||||||
#define GL_RGBA32F 0x8814
|
|
||||||
#define GL_HALF_FLOAT 0x140B
|
|
||||||
|
|
||||||
#define GL_RGB565 GL_RGBA
|
|
||||||
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
|
||||||
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
|
||||||
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
|
||||||
|
|
||||||
#define glGenVertexArrays glGenVertexArraysAPPLE
|
|
||||||
#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
|
|
||||||
#define glBindVertexArray glBindVertexArrayAPPLE
|
|
||||||
|
|
||||||
#define GL_PROGRAM_BINARY_LENGTH 0
|
|
||||||
#define glGetProgramBinary(...) 0
|
|
||||||
#define glProgramBinary(...) 0
|
|
||||||
#endif
|
#endif
|
||||||
#elif __EMSCRIPTEN__
|
#elif __EMSCRIPTEN__
|
||||||
#define _OS_WEB
|
#define _OS_WEB
|
||||||
#define _GAPI_GL
|
#define _GAPI_GL
|
||||||
#define _GAPI_GLES
|
#define _GAPI_GLES
|
||||||
|
|
||||||
#include <emscripten/emscripten.h>
|
|
||||||
#include <emscripten/html5.h>
|
|
||||||
#include <GLES3/gl3.h>
|
|
||||||
#include <GLES3/gl2ext.h>
|
|
||||||
|
|
||||||
#define GL_CLAMP_TO_BORDER GL_CLAMP_TO_BORDER_EXT
|
|
||||||
#define GL_TEXTURE_BORDER_COLOR GL_TEXTURE_BORDER_COLOR_EXT
|
|
||||||
|
|
||||||
#define glGetProgramBinary(...)
|
|
||||||
#define glProgramBinary(...)
|
|
||||||
|
|
||||||
#undef OS_FILEIO_CACHE
|
#undef OS_FILEIO_CACHE
|
||||||
#elif _PSP
|
#elif _PSP
|
||||||
#define _OS_PSP
|
#define _OS_PSP
|
||||||
#define _GAPI_SCEGU
|
#define _GAPI_SCEGU
|
||||||
#include <pspgu.h>
|
|
||||||
#include <pspgum.h>
|
|
||||||
|
|
||||||
#define FFP
|
#define FFP
|
||||||
#define TEX_SWIZZLE
|
#define TEX_SWIZZLE
|
||||||
@@ -434,8 +301,6 @@ namespace Core {
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_LIGHTS 4
|
#define MAX_LIGHTS 4
|
||||||
#define MAX_RENDER_BUFFERS 32
|
#define MAX_RENDER_BUFFERS 32
|
||||||
#define MAX_CONTACTS 15
|
#define MAX_CONTACTS 15
|
||||||
@@ -518,20 +383,6 @@ namespace Core {
|
|||||||
|
|
||||||
enum Pass { passCompose, passShadow, passAmbient, passWater, passFilter, passGUI, passMAX } pass;
|
enum Pass { passCompose, passShadow, passAmbient, passWater, passFilter, passGUI, passMAX } pass;
|
||||||
|
|
||||||
#ifdef _OS_PSP
|
|
||||||
void *curBackBuffer;
|
|
||||||
#else
|
|
||||||
GLuint FBO, defaultFBO;
|
|
||||||
struct RenderTargetCache {
|
|
||||||
int count;
|
|
||||||
struct Item {
|
|
||||||
GLuint ID;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
} items[MAX_RENDER_BUFFERS];
|
|
||||||
} rtCache[2];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Texture *defaultTarget;
|
Texture *defaultTarget;
|
||||||
|
|
||||||
int32 renderState;
|
int32 renderState;
|
||||||
@@ -547,13 +398,14 @@ namespace Core {
|
|||||||
uint32 targetOp;
|
uint32 targetOp;
|
||||||
vec4 viewport;
|
vec4 viewport;
|
||||||
vec4 material;
|
vec4 material;
|
||||||
#ifdef _OS_PSP
|
|
||||||
Index *iBuffer;
|
#ifdef _GAPI_GL
|
||||||
|
uint32 VAO;
|
||||||
|
uint32 iBuffer;
|
||||||
|
uint32 vBuffer;
|
||||||
|
#elif _GAPI_SCEGU
|
||||||
|
Index *iBuffer;
|
||||||
GAPI::Vertex *vBuffer;
|
GAPI::Vertex *vBuffer;
|
||||||
#else
|
|
||||||
GLuint VAO;
|
|
||||||
GLuint iBuffer;
|
|
||||||
GLuint vBuffer;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32 basisCount;
|
int32 basisCount;
|
||||||
@@ -610,6 +462,7 @@ namespace Core {
|
|||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
|
|
||||||
#ifdef USE_INFLATE
|
#ifdef USE_INFLATE
|
||||||
tinf_init();
|
tinf_init();
|
||||||
#endif
|
#endif
|
||||||
@@ -639,7 +492,6 @@ namespace Core {
|
|||||||
LOG("\n");
|
LOG("\n");
|
||||||
|
|
||||||
defaultTarget = NULL;
|
defaultTarget = NULL;
|
||||||
memset(rtCache, 0, sizeof(rtCache));
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_LIGHTS; i++) {
|
for (int i = 0; i < MAX_LIGHTS; i++) {
|
||||||
lightPos[i] = vec3(0.0);
|
lightPos[i] = vec3(0.0);
|
||||||
@@ -715,7 +567,7 @@ namespace Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use S key for action on Mac because Ctrl + Left/Right used by system (default)
|
// use S key for action on Mac because Ctrl + Left/Right used by system (default)
|
||||||
#ifdef _OS_MACOS
|
#ifdef _OS_MAC
|
||||||
settings.controls[0].keys[ cAction ].key = ikS;
|
settings.controls[0].keys[ cAction ].key = ikS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -766,28 +618,6 @@ namespace Core {
|
|||||||
GAPI::waitVBlank();
|
GAPI::waitVBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _OS_PSP
|
|
||||||
int cacheRenderTarget(bool depth, int width, int height) {
|
|
||||||
RenderTargetCache &cache = rtCache[depth];
|
|
||||||
|
|
||||||
for (int i = 0; i < cache.count; i++)
|
|
||||||
if (cache.items[i].width == width && cache.items[i].height == height)
|
|
||||||
return i;
|
|
||||||
|
|
||||||
ASSERT(cache.count < MAX_RENDER_BUFFERS);
|
|
||||||
|
|
||||||
RenderTargetCache::Item &item = cache.items[cache.count];
|
|
||||||
item.width = width;
|
|
||||||
item.height = height;
|
|
||||||
|
|
||||||
glGenRenderbuffers(1, &item.ID);
|
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, item.ID);
|
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, depth ? GL_RGB565 : GL_DEPTH_COMPONENT16, width, height);
|
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
|
||||||
return cache.count++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool update() {
|
bool update() {
|
||||||
resetState = false;
|
resetState = false;
|
||||||
int time = getTime();
|
int time = getTime();
|
||||||
@@ -809,34 +639,11 @@ namespace Core {
|
|||||||
uint32 face = reqTarget.face;
|
uint32 face = reqTarget.face;
|
||||||
|
|
||||||
if (target != active.target || face != active.targetFace) {
|
if (target != active.target || face != active.targetFace) {
|
||||||
#ifdef _OS_PSP
|
|
||||||
/*
|
|
||||||
if (!target)
|
|
||||||
sceGuDrawBufferList(GU_PSM_5650, curBackBuffer, 512);
|
|
||||||
else
|
|
||||||
sceGuDrawBufferList(GU_PSM_5650, target->offset, target->width);
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
bool depth = false;
|
|
||||||
|
|
||||||
Core::stats.rt++;
|
Core::stats.rt++;
|
||||||
if (!target) { // may be a null
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
|
||||||
} else {
|
|
||||||
GLenum texTarget = GL_TEXTURE_2D;
|
|
||||||
if (target->opt & Texture::CUBEMAP)
|
|
||||||
texTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
|
|
||||||
|
|
||||||
depth = target->format == FMT_DEPTH || target->format == FMT_SHADOW;
|
GAPI::bindTarget(target, face);
|
||||||
|
|
||||||
int rtIndex = cacheRenderTarget(depth, target->width, target->height);
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
|
|
||||||
glFramebufferTexture2D (GL_FRAMEBUFFER, depth ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0, texTarget, target->ID, 0);
|
|
||||||
glFramebufferRenderbuffer (GL_FRAMEBUFFER, depth ? GL_COLOR_ATTACHMENT0 : GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rtCache[depth].items[rtIndex].ID);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
bool depth = target && (target->format == FMT_DEPTH || target->format == FMT_SHADOW);
|
||||||
if (support.discardFrame) {
|
if (support.discardFrame) {
|
||||||
if (!(reqTarget.op & RT_LOAD_COLOR) && !depth) reqTarget.op |= RT_CLEAR_COLOR;
|
if (!(reqTarget.op & RT_LOAD_COLOR) && !depth) reqTarget.op |= RT_CLEAR_COLOR;
|
||||||
if (!(reqTarget.op & RT_LOAD_DEPTH) && depth) reqTarget.op |= RT_CLEAR_DEPTH;
|
if (!(reqTarget.op & RT_LOAD_DEPTH) && depth) reqTarget.op |= RT_CLEAR_DEPTH;
|
||||||
@@ -976,11 +783,7 @@ namespace Core {
|
|||||||
|
|
||||||
void copyTarget(Texture *dst, int xOffset, int yOffset, int x, int y, int width, int height) {
|
void copyTarget(Texture *dst, int xOffset, int yOffset, int x, int y, int width, int height) {
|
||||||
validateRenderState();
|
validateRenderState();
|
||||||
// GAPI::copyTarget(dst, xOffset, yOffset, x, y, width, height); TODO
|
GAPI::copyTarget(dst, xOffset, yOffset, x, y, width, height);
|
||||||
dst->bind(sDiffuse);
|
|
||||||
#ifdef _GAPI_GL
|
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, x, y, width, height); // TODO: too bad for iOS devices!
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 copyPixel(int x, int y) { // GPU sync!
|
vec4 copyPixel(int x, int y) { // GPU sync!
|
||||||
|
@@ -11,7 +11,7 @@ namespace Debug {
|
|||||||
static GLuint font;
|
static GLuint font;
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
font = glGenLists(256);
|
font = glGenLists(256);
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC(0);
|
||||||
HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0,
|
HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0,
|
||||||
|
217
src/gapi_gl.h
217
src/gapi_gl.h
@@ -3,13 +3,142 @@
|
|||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
|
||||||
#if defined(_OS_WINDOWS) || (defined(_OS_LINUX) && !defined(_OS_RPI)) || defined(_OS_ANDROID)
|
#ifdef _OS_WIN
|
||||||
|
#include <gl/GL.h>
|
||||||
|
#include <gl/glext.h>
|
||||||
|
#elif _OS_ANDROID
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include <GLES2/gl2.h>
|
||||||
|
#include <GLES2/gl2ext.h>
|
||||||
|
#define GL_CLAMP_TO_BORDER 0x812D
|
||||||
|
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||||
|
|
||||||
|
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
||||||
|
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
||||||
|
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
||||||
|
|
||||||
|
#define GL_RGBA16F 0x881A
|
||||||
|
#define GL_RGBA32F 0x8814
|
||||||
|
#define GL_HALF_FLOAT 0x140B
|
||||||
|
|
||||||
|
#define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
|
||||||
|
#define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
|
||||||
|
|
||||||
|
#define PFNGLGENVERTEXARRAYSPROC PFNGLGENVERTEXARRAYSOESPROC
|
||||||
|
#define PFNGLDELETEVERTEXARRAYSPROC PFNGLDELETEVERTEXARRAYSOESPROC
|
||||||
|
#define PFNGLBINDVERTEXARRAYPROC PFNGLBINDVERTEXARRAYOESPROC
|
||||||
|
#define glGenVertexArrays glGenVertexArraysOES
|
||||||
|
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
||||||
|
#define glBindVertexArray glBindVertexArrayOES
|
||||||
|
|
||||||
|
#define PFNGLGETPROGRAMBINARYPROC PFNGLGETPROGRAMBINARYOESPROC
|
||||||
|
#define PFNGLPROGRAMBINARYPROC PFNGLPROGRAMBINARYOESPROC
|
||||||
|
#define glGetProgramBinary glGetProgramBinaryOES
|
||||||
|
#define glProgramBinary glProgramBinaryOES
|
||||||
|
|
||||||
|
#define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
|
||||||
|
#elif _OS_RPI
|
||||||
|
#include <GLES2/gl2.h>
|
||||||
|
#include <GLES2/gl2ext.h>
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <EGL/eglext.h>
|
||||||
|
|
||||||
|
#define GL_CLAMP_TO_BORDER 0x812D
|
||||||
|
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||||
|
|
||||||
|
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
||||||
|
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
||||||
|
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
||||||
|
|
||||||
|
#undef GL_RGBA32F
|
||||||
|
#undef GL_RGBA16F
|
||||||
|
#undef GL_HALF_FLOAT
|
||||||
|
|
||||||
|
#define GL_RGBA32F GL_RGBA
|
||||||
|
#define GL_RGBA16F GL_RGBA
|
||||||
|
#define GL_HALF_FLOAT GL_HALF_FLOAT_OES
|
||||||
|
|
||||||
|
#define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
|
||||||
|
#define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
|
||||||
|
|
||||||
|
#define glGenVertexArrays(...)
|
||||||
|
#define glDeleteVertexArrays(...)
|
||||||
|
#define glBindVertexArray(...)
|
||||||
|
|
||||||
|
#define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
|
||||||
|
#define glGetProgramBinary(...)
|
||||||
|
#define glProgramBinary(...)
|
||||||
|
|
||||||
|
extern EGLDisplay display;
|
||||||
|
#elif _OS_LINUX
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glext.h>
|
||||||
|
#include <GL/glx.h>
|
||||||
|
#elif __APPLE__
|
||||||
|
#ifdef _OS_IOS
|
||||||
|
#include <OpenGLES/ES2/gl.h>
|
||||||
|
#include <OpenGLES/ES2/glext.h>
|
||||||
|
#include <OpenGLES/ES3/glext.h>
|
||||||
|
|
||||||
|
#define PFNGLGENVERTEXARRAYSPROC PFNGLGENVERTEXARRAYSOESPROC
|
||||||
|
#define PFNGLDELETEVERTEXARRAYSPROC PFNGLDELETEVERTEXARRAYSOESPROC
|
||||||
|
#define PFNGLBINDVERTEXARRAYPROC PFNGLBINDVERTEXARRAYOESPROC
|
||||||
|
#define glGenVertexArrays glGenVertexArraysOES
|
||||||
|
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
||||||
|
#define glBindVertexArray glBindVertexArrayOES
|
||||||
|
|
||||||
|
#define GL_CLAMP_TO_BORDER 0x812D
|
||||||
|
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||||
|
|
||||||
|
#define GL_TEXTURE_COMPARE_MODE GL_TEXTURE_COMPARE_MODE_EXT
|
||||||
|
#define GL_TEXTURE_COMPARE_FUNC GL_TEXTURE_COMPARE_FUNC_EXT
|
||||||
|
#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_REF_TO_TEXTURE_EXT
|
||||||
|
#else
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#include <AudioToolbox/AudioQueue.h>
|
||||||
|
#include <OpenGL/OpenGL.h>
|
||||||
|
#include <OpenGL/gl.h>
|
||||||
|
#include <OpenGL/glext.h>
|
||||||
|
#include <AGL/agl.h>
|
||||||
|
|
||||||
|
#define GL_RGBA16F 0x881A
|
||||||
|
#define GL_RGBA32F 0x8814
|
||||||
|
#define GL_HALF_FLOAT 0x140B
|
||||||
|
|
||||||
|
#define GL_RGB565 GL_RGBA
|
||||||
|
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
||||||
|
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
||||||
|
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
||||||
|
|
||||||
|
#define glGenVertexArrays glGenVertexArraysAPPLE
|
||||||
|
#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
|
||||||
|
#define glBindVertexArray glBindVertexArrayAPPLE
|
||||||
|
|
||||||
|
#define GL_PROGRAM_BINARY_LENGTH 0
|
||||||
|
#define glGetProgramBinary(...) 0
|
||||||
|
#define glProgramBinary(...) 0
|
||||||
|
#endif
|
||||||
|
#elif _OS_WEB
|
||||||
|
#include <emscripten/emscripten.h>
|
||||||
|
#include <emscripten/html5.h>
|
||||||
|
#include <GLES3/gl3.h>
|
||||||
|
#include <GLES3/gl2ext.h>
|
||||||
|
|
||||||
|
#define GL_CLAMP_TO_BORDER GL_CLAMP_TO_BORDER_EXT
|
||||||
|
#define GL_TEXTURE_BORDER_COLOR GL_TEXTURE_BORDER_COLOR_EXT
|
||||||
|
|
||||||
|
#define glGetProgramBinary(...)
|
||||||
|
#define glProgramBinary(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_OS_WIN) || (defined(_OS_LINUX) && !defined(_OS_RPI)) || defined(_OS_ANDROID)
|
||||||
|
|
||||||
#ifdef _OS_ANDROID
|
#ifdef _OS_ANDROID
|
||||||
#define GetProc(x) dlsym(libGL, x);
|
#define GetProc(x) dlsym(libGL, x);
|
||||||
#else
|
#else
|
||||||
void* GetProc(const char *name) {
|
void* GetProc(const char *name) {
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
return (void*)wglGetProcAddress(name);
|
return (void*)wglGetProcAddress(name);
|
||||||
#elif _OS_LINUX
|
#elif _OS_LINUX
|
||||||
return (void*)glXGetProcAddress((GLubyte*)name);
|
return (void*)glXGetProcAddress((GLubyte*)name);
|
||||||
@@ -22,12 +151,12 @@
|
|||||||
#define GetProcOGL(x) x=(decltype(x))GetProc(#x);
|
#define GetProcOGL(x) x=(decltype(x))GetProc(#x);
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VSync
|
// VSync
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
||||||
#elif _OS_LINUX
|
#elif _OS_LINUX
|
||||||
@@ -35,7 +164,7 @@
|
|||||||
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
|
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_OS_WINDOWS) || defined(_OS_LINUX)
|
#if defined(_OS_WIN) || defined(_OS_LINUX)
|
||||||
PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
|
PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
|
||||||
// Profiling
|
// Profiling
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
@@ -200,27 +329,49 @@ namespace GAPI {
|
|||||||
|
|
||||||
int cullMode, blendMode;
|
int cullMode, blendMode;
|
||||||
|
|
||||||
|
struct Texture {
|
||||||
|
enum Option { CUBEMAP = 1, MIPMAPS = 2, NEAREST = 4 };
|
||||||
|
|
||||||
|
uint32 ID;
|
||||||
|
int width, height, origWidth, origHeight;
|
||||||
|
Format format;
|
||||||
|
uint32 opt;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GLuint FBO, defaultFBO;
|
||||||
|
struct RenderTargetCache {
|
||||||
|
int count;
|
||||||
|
struct Item {
|
||||||
|
GLuint ID;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
} items[MAX_RENDER_BUFFERS];
|
||||||
|
} rtCache[2];
|
||||||
|
|
||||||
bool extSupport(const char *str, const char *ext) {
|
bool extSupport(const char *str, const char *ext) {
|
||||||
return strstr(str, ext) != NULL;
|
return strstr(str, ext) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
|
memset(rtCache, 0, sizeof(rtCache));
|
||||||
|
|
||||||
#ifdef _OS_ANDROID
|
#ifdef _OS_ANDROID
|
||||||
void *libGL = dlopen("libGLESv2.so", RTLD_LAZY);
|
void *libGL = dlopen("libGLESv2.so", RTLD_LAZY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_OS_WINDOWS) || (defined(_OS_LINUX) && !defined(_OS_RPI)) || defined(_OS_ANDROID)
|
#if defined(_OS_WIN) || (defined(_OS_LINUX) && !defined(_OS_RPI)) || defined(_OS_ANDROID)
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
GetProcOGL(glActiveTexture);
|
GetProcOGL(glActiveTexture);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
GetProcOGL(wglSwapIntervalEXT);
|
GetProcOGL(wglSwapIntervalEXT);
|
||||||
#elif _OS_LINUX
|
#elif _OS_LINUX
|
||||||
GetProcOGL(glXSwapIntervalSGI);
|
GetProcOGL(glXSwapIntervalSGI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_OS_WINDOWS) || defined(_OS_LINUX)
|
#if defined(_OS_WIN) || defined(_OS_LINUX)
|
||||||
GetProcOGL(glGenerateMipmap);
|
GetProcOGL(glGenerateMipmap);
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
@@ -399,6 +550,44 @@ namespace GAPI {
|
|||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cacheRenderTarget(bool depth, int width, int height) {
|
||||||
|
RenderTargetCache &cache = rtCache[depth];
|
||||||
|
|
||||||
|
for (int i = 0; i < cache.count; i++)
|
||||||
|
if (cache.items[i].width == width && cache.items[i].height == height)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
ASSERT(cache.count < MAX_RENDER_BUFFERS);
|
||||||
|
|
||||||
|
RenderTargetCache::Item &item = cache.items[cache.count];
|
||||||
|
item.width = width;
|
||||||
|
item.height = height;
|
||||||
|
|
||||||
|
glGenRenderbuffers(1, &item.ID);
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, item.ID);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, depth ? GL_RGB565 : GL_DEPTH_COMPONENT16, width, height);
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
|
return cache.count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bindTarget(Texture *target, int face) {
|
||||||
|
if (!target) { // may be a null
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||||
|
} else {
|
||||||
|
GLenum texTarget = GL_TEXTURE_2D;
|
||||||
|
if (target->opt & Texture::CUBEMAP)
|
||||||
|
texTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
|
||||||
|
|
||||||
|
bool depth = target->format == FMT_DEPTH || target->format == FMT_SHADOW;
|
||||||
|
|
||||||
|
int rtIndex = cacheRenderTarget(depth, target->width, target->height);
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
|
||||||
|
glFramebufferTexture2D (GL_FRAMEBUFFER, depth ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0, texTarget, target->ID, 0);
|
||||||
|
glFramebufferRenderbuffer (GL_FRAMEBUFFER, depth ? GL_COLOR_ATTACHMENT0 : GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rtCache[depth].items[rtIndex].ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void discardTarget(bool color, bool depth) {
|
void discardTarget(bool color, bool depth) {
|
||||||
#ifdef _GAPI_GLES
|
#ifdef _GAPI_GLES
|
||||||
if (Core::support.discardFrame) {
|
if (Core::support.discardFrame) {
|
||||||
@@ -412,8 +601,16 @@ namespace GAPI {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void copyTarget(Texture *dst, int xOffset, int yOffset, int x, int y, int width, int height) {
|
||||||
|
Core::active.textures[0] = NULL;
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, dst->ID);
|
||||||
|
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, x, y, width, height);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void setVSync(bool enable) {
|
void setVSync(bool enable) {
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
if (wglSwapIntervalEXT) wglSwapIntervalEXT(enable ? 1 : 0);
|
if (wglSwapIntervalEXT) wglSwapIntervalEXT(enable ? 1 : 0);
|
||||||
#elif _OS_LINUX
|
#elif _OS_LINUX
|
||||||
if (glXSwapIntervalSGI) glXSwapIntervalSGI(enable ? 1 : 0);
|
if (glXSwapIntervalSGI) glXSwapIntervalSGI(enable ? 1 : 0);
|
||||||
|
@@ -3,6 +3,14 @@
|
|||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
|
||||||
|
#include <pspgu.h>
|
||||||
|
#include <pspgum.h>
|
||||||
|
|
||||||
|
#define FFP
|
||||||
|
#define TEX_SWIZZLE
|
||||||
|
//#define EDRAM_MESH
|
||||||
|
#define EDRAM_TEX
|
||||||
|
|
||||||
namespace GAPI {
|
namespace GAPI {
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -17,6 +25,7 @@ namespace GAPI {
|
|||||||
int cullMode, blendMode;
|
int cullMode, blendMode;
|
||||||
|
|
||||||
uint32 *cmdBuf = NULL;
|
uint32 *cmdBuf = NULL;
|
||||||
|
void *curBackBuffer;
|
||||||
|
|
||||||
static int EDRAM_OFFSET;
|
static int EDRAM_OFFSET;
|
||||||
static int EDRAM_SIZE;
|
static int EDRAM_SIZE;
|
||||||
@@ -121,6 +130,15 @@ namespace GAPI {
|
|||||||
|
|
||||||
void resetState() {}
|
void resetState() {}
|
||||||
|
|
||||||
|
void bindTarget(Texture *texture, int face) {
|
||||||
|
/*
|
||||||
|
if (!target)
|
||||||
|
sceGuDrawBufferList(GU_PSM_5650, GAPI::curBackBuffer, 512);
|
||||||
|
else
|
||||||
|
sceGuDrawBufferList(GU_PSM_5650, target->offset, target->width);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
void discardTarget(bool color, bool depth) {}
|
void discardTarget(bool color, bool depth) {}
|
||||||
|
|
||||||
void setVSync(bool enable) {}
|
void setVSync(bool enable) {}
|
||||||
|
@@ -125,12 +125,12 @@ static const OptionItem optDetail[] = {
|
|||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_LIGHTING, SETTINGS( detail.lighting ), STR_QUALITY_LOW, 0, 2 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_LIGHTING, SETTINGS( detail.lighting ), STR_QUALITY_LOW, 0, 2 ),
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_SHADOWS, SETTINGS( detail.shadows ), STR_QUALITY_LOW, 0, 2 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_SHADOWS, SETTINGS( detail.shadows ), STR_QUALITY_LOW, 0, 2 ),
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_WATER, SETTINGS( detail.water ), STR_QUALITY_LOW, 0, 2 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_WATER, SETTINGS( detail.water ), STR_QUALITY_LOW, 0, 2 ),
|
||||||
#if defined(_OS_WINDOWS) || defined(_OS_LINUX) || defined(_OS_PSP) || defined(_OS_RPI)
|
#if defined(_OS_WIN) || defined(_OS_LINUX) || defined(_OS_PSP) || defined(_OS_RPI)
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_VSYNC, SETTINGS( detail.vsync ), STR_OFF, 0, 1 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_VSYNC, SETTINGS( detail.vsync ), STR_OFF, 0, 1 ),
|
||||||
#endif
|
#endif
|
||||||
#ifndef _OS_PSP
|
#ifndef _OS_PSP
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_STEREO, SETTINGS( detail.stereo ), STR_OFF, 0,
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_DETAIL_STEREO, SETTINGS( detail.stereo ), STR_OFF, 0,
|
||||||
#if /*defined(_OS_WINDOWS) ||*/ defined(_OS_ANDROID)
|
#if /*defined(_OS_WIN) ||*/ defined(_OS_ANDROID)
|
||||||
3 /* with VR option */
|
3 /* with VR option */
|
||||||
#else
|
#else
|
||||||
2 /* without VR support */
|
2 /* without VR support */
|
||||||
@@ -154,7 +154,7 @@ static const OptionItem optControls[] = {
|
|||||||
OptionItem( ),
|
OptionItem( ),
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_NOT_IMPLEMENTED , SETTINGS( playerIndex ), STR_PLAYER_1, 0, 1 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_NOT_IMPLEMENTED , SETTINGS( playerIndex ), STR_PLAYER_1, 0, 1 ),
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_GAMEPAD , SETTINGS( controls[0].joyIndex ), STR_GAMEPAD_1, 0, 3 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_GAMEPAD , SETTINGS( controls[0].joyIndex ), STR_GAMEPAD_1, 0, 3 ),
|
||||||
#ifdef _OS_WINDOWS
|
#ifdef _OS_WIN
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_VIBRATION , SETTINGS( controls[0].vibration ), STR_OFF, 0, 1 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_VIBRATION , SETTINGS( controls[0].vibration ), STR_OFF, 0, 1 ),
|
||||||
#endif
|
#endif
|
||||||
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_RETARGET , SETTINGS( controls[0].retarget ), STR_OFF, 0, 1 ),
|
OptionItem( OptionItem::TYPE_PARAM, STR_OPT_CONTROLS_RETARGET , SETTINGS( controls[0].retarget ), STR_OFF, 0, 1 ),
|
||||||
|
@@ -20,12 +20,12 @@ varying vec4 vTexCoord; // xy - atlas coords, zw - trapezoidal correction
|
|||||||
|
|
||||||
uniform mat4 uViewProj;
|
uniform mat4 uViewProj;
|
||||||
uniform vec3 uViewPos;
|
uniform vec3 uViewPos;
|
||||||
|
|
||||||
uniform vec4 uParam; // x - time, y - water height, z - clip plane sign, w - clip plane height
|
uniform vec4 uParam; // x - time, y - water height, z - clip plane sign, w - clip plane height
|
||||||
uniform vec4 uLightPos[MAX_LIGHTS];
|
uniform vec4 uLightPos[MAX_LIGHTS];
|
||||||
uniform vec4 uLightColor[MAX_LIGHTS]; // xyz - color, w - radius * intensity
|
uniform vec4 uLightColor[MAX_LIGHTS]; // xyz - color, w - radius * intensity
|
||||||
uniform vec4 uFogParams;
|
|
||||||
|
|
||||||
uniform vec4 uMaterial; // x - diffuse, y - ambient, z - specular, w - alpha
|
uniform vec4 uMaterial; // x - diffuse, y - ambient, z - specular, w - alpha
|
||||||
|
uniform vec4 uFogParams;
|
||||||
|
|
||||||
#ifndef PASS_SHADOW
|
#ifndef PASS_SHADOW
|
||||||
varying vec4 vViewVec; // xyz - dir * dist, w - coord.y * clipPlaneSign
|
varying vec4 vViewVec; // xyz - dir * dist, w - coord.y * clipPlaneSign
|
||||||
|
@@ -4,12 +4,7 @@
|
|||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
struct Texture {
|
struct Texture : GAPI::Texture {
|
||||||
enum Option { CUBEMAP = 1, MIPMAPS = 2, NEAREST = 4 };
|
|
||||||
|
|
||||||
int width, height, origWidth, origHeight;
|
|
||||||
Format format;
|
|
||||||
uint32 opt;
|
|
||||||
|
|
||||||
#ifdef _OS_PSP
|
#ifdef _OS_PSP
|
||||||
TR::Tile4 *tiles;
|
TR::Tile4 *tiles;
|
||||||
@@ -34,7 +29,6 @@ struct Texture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
uint32 ID;
|
|
||||||
Texture *tiles[32];
|
Texture *tiles[32];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -82,7 +76,8 @@ struct Texture {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Texture(int width, int height, Format format, uint32 opt = 0, void *data = NULL) : opt(opt) {
|
Texture(int width, int height, Format format, uint32 opt = 0, void *data = NULL) {
|
||||||
|
this->opt = opt;
|
||||||
// LOG("create texture %d x %d (%d)\n", width, height, format);
|
// LOG("create texture %d x %d (%d)\n", width, height, format);
|
||||||
|
|
||||||
#ifndef _OS_PSP
|
#ifndef _OS_PSP
|
||||||
|
Reference in New Issue
Block a user