mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-08 23:10:52 -04:00
Dreamcast: Simplify a bit more
This commit is contained in:
parent
8a01581945
commit
4c2a077751
3
.gitignore
vendored
3
.gitignore
vendored
@ -126,6 +126,9 @@ dlldata.c
|
|||||||
# Mac classic
|
# Mac classic
|
||||||
retro68scripts/
|
retro68scripts/
|
||||||
|
|
||||||
|
# PS2
|
||||||
|
openvcl/
|
||||||
|
|
||||||
*_i.c
|
*_i.c
|
||||||
*_p.c
|
*_p.c
|
||||||
*_i.h
|
*_i.h
|
||||||
|
@ -37,15 +37,15 @@ static void InitGLState(void) {
|
|||||||
pvr_set_zclip(0.0f);
|
pvr_set_zclip(0.0f);
|
||||||
PVR_SET(PT_ALPHA_REF, 127); // define missing from KOS
|
PVR_SET(PT_ALPHA_REF, 127); // define missing from KOS
|
||||||
|
|
||||||
ALPHA_TEST_ENABLED = GL_FALSE;
|
ALPHA_TEST_ENABLED = false;
|
||||||
CULLING_ENABLED = GL_FALSE;
|
CULLING_ENABLED = false;
|
||||||
BLEND_ENABLED = GL_FALSE;
|
BLEND_ENABLED = false;
|
||||||
DEPTH_TEST_ENABLED = GL_FALSE;
|
DEPTH_TEST_ENABLED = false;
|
||||||
DEPTH_MASK_ENABLED = GL_TRUE;
|
DEPTH_MASK_ENABLED = true;
|
||||||
TEXTURES_ENABLED = GL_FALSE;
|
TEXTURES_ENABLED = false;
|
||||||
FOG_ENABLED = GL_FALSE;
|
FOG_ENABLED = false;
|
||||||
|
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_Create(void) {
|
void Gfx_Create(void) {
|
||||||
@ -80,12 +80,12 @@ static PackedCol gfx_clearColor;
|
|||||||
|
|
||||||
void Gfx_SetFaceCulling(cc_bool enabled) {
|
void Gfx_SetFaceCulling(cc_bool enabled) {
|
||||||
CULLING_ENABLED = enabled;
|
CULLING_ENABLED = enabled;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetAlphaBlend(cc_bool enabled) {
|
static void SetAlphaBlend(cc_bool enabled) {
|
||||||
BLEND_ENABLED = enabled;
|
BLEND_ENABLED = enabled;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
void Gfx_SetAlphaArgBlend(cc_bool enabled) { }
|
void Gfx_SetAlphaArgBlend(cc_bool enabled) { }
|
||||||
|
|
||||||
@ -107,19 +107,19 @@ void Gfx_SetDepthWrite(cc_bool enabled) {
|
|||||||
if (DEPTH_MASK_ENABLED == enabled) return;
|
if (DEPTH_MASK_ENABLED == enabled) return;
|
||||||
|
|
||||||
DEPTH_MASK_ENABLED = enabled;
|
DEPTH_MASK_ENABLED = enabled;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetDepthTest(cc_bool enabled) {
|
void Gfx_SetDepthTest(cc_bool enabled) {
|
||||||
if (DEPTH_TEST_ENABLED == enabled) return;
|
if (DEPTH_TEST_ENABLED == enabled) return;
|
||||||
|
|
||||||
DEPTH_TEST_ENABLED = enabled;
|
DEPTH_TEST_ENABLED = enabled;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
ALPHA_TEST_ENABLED = enabled;
|
ALPHA_TEST_ENABLED = enabled;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
||||||
@ -228,6 +228,7 @@ void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); }
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
void Gfx_BindTexture(GfxResourceID texId) {
|
void Gfx_BindTexture(GfxResourceID texId) {
|
||||||
gldcBindTexture((GLuint)texId);
|
gldcBindTexture((GLuint)texId);
|
||||||
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DeleteTexture(GfxResourceID* texId) {
|
void Gfx_DeleteTexture(GfxResourceID* texId) {
|
||||||
@ -395,7 +396,7 @@ void Gfx_SetFog(cc_bool enabled) {
|
|||||||
if (FOG_ENABLED == enabled) return;
|
if (FOG_ENABLED == enabled) return;
|
||||||
|
|
||||||
FOG_ENABLED = enabled;
|
FOG_ENABLED = enabled;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetFogCol(PackedCol color) {
|
void Gfx_SetFogCol(PackedCol color) {
|
||||||
@ -521,7 +522,7 @@ void DrawQuads(int count, void* src) {
|
|||||||
|
|
||||||
if (header_required) {
|
if (header_required) {
|
||||||
apply_poly_header((pvr_poly_hdr_t*)beg, output->list_type);
|
apply_poly_header((pvr_poly_hdr_t*)beg, output->list_type);
|
||||||
STATE_DIRTY = GL_FALSE;
|
STATE_DIRTY = false;
|
||||||
beg++;
|
beg++;
|
||||||
vec->size += 1;
|
vec->size += 1;
|
||||||
}
|
}
|
||||||
@ -541,7 +542,7 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
|
|||||||
gfx_stride = strideSizes[fmt];
|
gfx_stride = strideSizes[fmt];
|
||||||
|
|
||||||
TEXTURES_ENABLED = fmt == VERTEX_FORMAT_TEXTURED;
|
TEXTURES_ENABLED = fmt == VERTEX_FORMAT_TEXTURED;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawVb_Lines(int verticesCount) {
|
void Gfx_DrawVb_Lines(int verticesCount) {
|
||||||
@ -620,19 +621,40 @@ extern float VP_COL_HHEIGHT, VP_TEX_HHEIGHT;
|
|||||||
extern float VP_COL_X_PLUS_HWIDTH, VP_TEX_X_PLUS_HWIDTH;
|
extern float VP_COL_X_PLUS_HWIDTH, VP_TEX_X_PLUS_HWIDTH;
|
||||||
extern float VP_COL_Y_PLUS_HHEIGHT, VP_TEX_Y_PLUS_HHEIGHT;
|
extern float VP_COL_Y_PLUS_HHEIGHT, VP_TEX_Y_PLUS_HHEIGHT;
|
||||||
|
|
||||||
void Gfx_SetViewport(int x, int y, int w, int h) {
|
static void PushCommand(void* cmd) {
|
||||||
glViewport(x, y, w, h);
|
aligned_vector_push_back(&OP_LIST.vector, cmd, 1);
|
||||||
|
aligned_vector_push_back(&PT_LIST.vector, cmd, 1);
|
||||||
|
aligned_vector_push_back(&TR_LIST.vector, cmd, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gfx_SetViewport(int x, int y, int w, int h) {
|
||||||
VP_COL_HWIDTH = VP_TEX_HWIDTH = w * 0.5f;
|
VP_COL_HWIDTH = VP_TEX_HWIDTH = w * 0.5f;
|
||||||
VP_COL_HHEIGHT = VP_TEX_HHEIGHT = h * -0.5f;
|
VP_COL_HHEIGHT = VP_TEX_HHEIGHT = h * -0.5f;
|
||||||
|
|
||||||
VP_COL_X_PLUS_HWIDTH = VP_TEX_X_PLUS_HWIDTH = x + w * 0.5f;
|
VP_COL_X_PLUS_HWIDTH = VP_TEX_X_PLUS_HWIDTH = x + w * 0.5f;
|
||||||
VP_COL_Y_PLUS_HHEIGHT = VP_TEX_Y_PLUS_HHEIGHT = y + h * 0.5f;
|
VP_COL_Y_PLUS_HHEIGHT = VP_TEX_Y_PLUS_HHEIGHT = y + h * 0.5f;
|
||||||
|
|
||||||
|
Vertex c;
|
||||||
|
c.flags = PVR_CMD_USERCLIP | 0x23;
|
||||||
|
c.x = w * 0.5f; // hwidth
|
||||||
|
c.y = h * -0.5f; // hheight
|
||||||
|
c.z = x + w * 0.5f; // x_plus_hwidth
|
||||||
|
c.w = y + h * 0.5f; // y_plus_hheight
|
||||||
|
PushCommand(&c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetScissor(int x, int y, int w, int h) {
|
void Gfx_SetScissor(int x, int y, int w, int h) {
|
||||||
SCISSOR_TEST_ENABLED = x != 0 || y != 0 || w != Game.Width || h != Game.Height;
|
SCISSOR_TEST_ENABLED = x != 0 || y != 0 || w != Game.Width || h != Game.Height;
|
||||||
STATE_DIRTY = GL_TRUE;
|
STATE_DIRTY = true;
|
||||||
glScissor(x, y, w, h);
|
|
||||||
|
pvr_poly_hdr_t c;
|
||||||
|
c.cmd = PVR_CMD_USERCLIP;
|
||||||
|
c.mode1 = c.mode2 = c.mode3 = 0;
|
||||||
|
|
||||||
|
c.d1 = x >> 5;
|
||||||
|
c.d2 = y >> 5;
|
||||||
|
c.d3 = ((x + w) >> 5) - 1;
|
||||||
|
c.d4 = ((y + h) >> 5) - 1;
|
||||||
|
PushCommand(&c);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
44
src/Menus.c
44
src/Menus.c
@ -157,13 +157,18 @@ static void Menu_CycleSelected(struct Screen* s, int dir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Menu_ClickSelected(struct Screen* s) {
|
static void Menu_InputSelected(struct Screen* s, int key) {
|
||||||
struct Widget* w;
|
struct Widget* w;
|
||||||
if (s->selectedI < 0) return;
|
if (s->selectedI < 0) return;
|
||||||
w = s->widgets[s->selectedI];
|
|
||||||
|
|
||||||
|
w = s->widgets[s->selectedI];
|
||||||
if (!Menu_IsSelectable(w)) return;
|
if (!Menu_IsSelectable(w)) return;
|
||||||
if (w->MenuClick) w->MenuClick(s, w);
|
|
||||||
|
if (w->MenuClick && Input_IsEnterButton(key)) {
|
||||||
|
w->MenuClick(s, w);
|
||||||
|
} else {
|
||||||
|
Elem_HandlesKeyDown(w, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Menu_InputDown(void* screen, int key) {
|
int Menu_InputDown(void* screen, int key) {
|
||||||
@ -173,8 +178,8 @@ int Menu_InputDown(void* screen, int key) {
|
|||||||
Menu_CycleSelected(s, -1);
|
Menu_CycleSelected(s, -1);
|
||||||
} else if (Input_IsDownButton(key)) {
|
} else if (Input_IsDownButton(key)) {
|
||||||
Menu_CycleSelected(s, +1);
|
Menu_CycleSelected(s, +1);
|
||||||
} else if (Input_IsEnterButton(key)) {
|
} else {
|
||||||
Menu_ClickSelected(s);
|
Menu_InputSelected(s, key);
|
||||||
}
|
}
|
||||||
return Screen_InputDown(screen, key);
|
return Screen_InputDown(screen, key);
|
||||||
}
|
}
|
||||||
@ -1116,20 +1121,6 @@ static struct TextInputWidget* GenLevelScreen_SelectedInput(struct GenLevelScree
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GenLevelScreen_KeyDown(void* screen, int key) {
|
|
||||||
struct GenLevelScreen* s = (struct GenLevelScreen*)screen;
|
|
||||||
struct TextInputWidget* selected = GenLevelScreen_SelectedInput(s);
|
|
||||||
struct MenuInputDesc* desc;
|
|
||||||
|
|
||||||
if (selected) {
|
|
||||||
if (Elem_HandlesKeyDown(&selected->base, key)) return true;
|
|
||||||
|
|
||||||
desc = &selected->desc;
|
|
||||||
if (desc->VTABLE->ProcessInput(desc, &selected->base.text, key)) return true;
|
|
||||||
}
|
|
||||||
return Menu_InputDown(s, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int GenLevelScreen_KeyPress(void* screen, char keyChar) {
|
static int GenLevelScreen_KeyPress(void* screen, char keyChar) {
|
||||||
struct GenLevelScreen* s = (struct GenLevelScreen*)screen;
|
struct GenLevelScreen* s = (struct GenLevelScreen*)screen;
|
||||||
struct TextInputWidget* selected = GenLevelScreen_SelectedInput(s);
|
struct TextInputWidget* selected = GenLevelScreen_SelectedInput(s);
|
||||||
@ -1236,7 +1227,7 @@ static void GenLevelScreen_Init(void* screen) {
|
|||||||
static const struct ScreenVTABLE GenLevelScreen_VTABLE = {
|
static const struct ScreenVTABLE GenLevelScreen_VTABLE = {
|
||||||
GenLevelScreen_Init, GenLevelScreen_Update, Menu_CloseKeyboard,
|
GenLevelScreen_Init, GenLevelScreen_Update, Menu_CloseKeyboard,
|
||||||
MenuScreen_Render2, Screen_BuildMesh,
|
MenuScreen_Render2, Screen_BuildMesh,
|
||||||
GenLevelScreen_KeyDown, Screen_InputUp, GenLevelScreen_KeyPress, GenLevelScreen_TextChanged,
|
Menu_InputDown, Screen_InputUp, GenLevelScreen_KeyPress, GenLevelScreen_TextChanged,
|
||||||
GenLevelScreen_PointerDown, Screen_PointerUp, Menu_PointerMove, Screen_TMouseScroll,
|
GenLevelScreen_PointerDown, Screen_PointerUp, Menu_PointerMove, Screen_TMouseScroll,
|
||||||
GenLevelScreen_Layout, GenLevelScreen_ContextLost, GenLevelScreen_ContextRecreated
|
GenLevelScreen_Layout, GenLevelScreen_ContextLost, GenLevelScreen_ContextRecreated
|
||||||
};
|
};
|
||||||
@ -1462,10 +1453,7 @@ static int SaveLevelScreen_TextChanged(void* screen, const cc_string* str) {
|
|||||||
|
|
||||||
static int SaveLevelScreen_KeyDown(void* screen, int key) {
|
static int SaveLevelScreen_KeyDown(void* screen, int key) {
|
||||||
struct SaveLevelScreen* s = (struct SaveLevelScreen*)screen;
|
struct SaveLevelScreen* s = (struct SaveLevelScreen*)screen;
|
||||||
if (Elem_HandlesKeyDown(&s->input.base, key)) {
|
SaveLevelScreen_RemoveOverwrites(s);
|
||||||
SaveLevelScreen_RemoveOverwrites(s);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return Menu_InputDown(s, key);
|
return Menu_InputDown(s, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1495,6 +1483,8 @@ static void SaveLevelScreen_ContextRecreated(void* screen) {
|
|||||||
|
|
||||||
static void SaveLevelScreen_Update(void* screen, float delta) {
|
static void SaveLevelScreen_Update(void* screen, float delta) {
|
||||||
struct SaveLevelScreen* s = (struct SaveLevelScreen*)screen;
|
struct SaveLevelScreen* s = (struct SaveLevelScreen*)screen;
|
||||||
|
if (!s->input.base.active) return;
|
||||||
|
|
||||||
s->input.base.caretAccumulator += delta;
|
s->input.base.caretAccumulator += delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1521,7 +1511,9 @@ static void SaveLevelScreen_Init(void* screen) {
|
|||||||
ButtonWidget_Add(s, &s->file, 400, SaveLevelScreen_File);
|
ButtonWidget_Add(s, &s->file, 400, SaveLevelScreen_File);
|
||||||
|
|
||||||
ButtonWidget_Add(s, &s->cancel, 400, Menu_SwitchPause);
|
ButtonWidget_Add(s, &s->cancel, 400, Menu_SwitchPause);
|
||||||
TextInputWidget_Add(s, &s->input, 400, &World.Name, &desc);
|
TextInputWidget_Add(s, &s->input, 400, &World.Name, &desc);
|
||||||
|
Menu_SelectWidget((struct Screen*)s, 3); /* s->input */
|
||||||
|
|
||||||
TextWidget_Add(s, &s->desc);
|
TextWidget_Add(s, &s->desc);
|
||||||
s->input.onscreenPlaceholder = "Map name";
|
s->input.onscreenPlaceholder = "Map name";
|
||||||
|
|
||||||
@ -2285,7 +2277,6 @@ static int MenuInputOverlay_TextChanged(void* screen, const cc_string* str) {
|
|||||||
|
|
||||||
static int MenuInputOverlay_KeyDown(void* screen, int key) {
|
static int MenuInputOverlay_KeyDown(void* screen, int key) {
|
||||||
struct MenuInputOverlay* s = (struct MenuInputOverlay*)screen;
|
struct MenuInputOverlay* s = (struct MenuInputOverlay*)screen;
|
||||||
if (Elem_HandlesKeyDown(&s->input.base, key)) return true;
|
|
||||||
|
|
||||||
if (Input_IsEnterButton(key)) {
|
if (Input_IsEnterButton(key)) {
|
||||||
MenuInputOverlay_EnterInput(s); return true;
|
MenuInputOverlay_EnterInput(s); return true;
|
||||||
@ -2326,6 +2317,7 @@ static void MenuInputOverlay_Init(void* screen) {
|
|||||||
ButtonWidget_Add(s, &s->ok, Input_TouchMode ? 200 : 40, MenuInputOverlay_OK);
|
ButtonWidget_Add(s, &s->ok, Input_TouchMode ? 200 : 40, MenuInputOverlay_OK);
|
||||||
ButtonWidget_Add(s, &s->Default, 200, MenuInputOverlay_Default);
|
ButtonWidget_Add(s, &s->Default, 200, MenuInputOverlay_Default);
|
||||||
TextInputWidget_Add(s, &s->input, 400, &s->value, s->desc);
|
TextInputWidget_Add(s, &s->input, 400, &s->value, s->desc);
|
||||||
|
Menu_SelectWidget((struct Screen*)s, 2); /* s->input */
|
||||||
|
|
||||||
if (s->desc->VTABLE == &IntInput_VTABLE) {
|
if (s->desc->VTABLE == &IntInput_VTABLE) {
|
||||||
s->input.onscreenType = KEYBOARD_TYPE_INTEGER;
|
s->input.onscreenType = KEYBOARD_TYPE_INTEGER;
|
||||||
|
@ -1686,12 +1686,15 @@ void TextInputWidget_OpenKeyboard(struct TextInputWidget* w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int TextInputWidget_KeyDown(void* widget, int key) {
|
static int TextInputWidget_KeyDown(void* widget, int key) {
|
||||||
struct InputWidget* w = (struct InputWidget*)widget;
|
struct TextInputWidget* w = (struct TextInputWidget*)widget;
|
||||||
|
struct MenuInputDesc* desc = &w->desc;
|
||||||
|
|
||||||
if (Window_Main.SoftKeyboard && !DisplayInfo.ShowingSoftKeyboard && Input_IsEnterButton(key)) {
|
if (Window_Main.SoftKeyboard && !DisplayInfo.ShowingSoftKeyboard && Input_IsEnterButton(key)) {
|
||||||
TextInputWidget_OpenKeyboard(widget); return true;
|
TextInputWidget_OpenKeyboard(w); return true;
|
||||||
}
|
}
|
||||||
return InputWidget_KeyDown(w, key);
|
if (InputWidget_KeyDown(&w->base, key)) return true;
|
||||||
|
|
||||||
|
return desc->VTABLE->ProcessInput(desc, &w->base.text, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int TextInputWidget_PointerDown(void* widget, int id, int x, int y) {
|
static int TextInputWidget_PointerDown(void* widget, int id, int x, int y) {
|
||||||
|
6
third_party/gldc/src/gldc.h
vendored
6
third_party/gldc/src/gldc.h
vendored
@ -16,9 +16,6 @@
|
|||||||
#define GLubyte unsigned char
|
#define GLubyte unsigned char
|
||||||
#define GLboolean unsigned char
|
#define GLboolean unsigned char
|
||||||
|
|
||||||
#define GL_FALSE 0
|
|
||||||
#define GL_TRUE 1
|
|
||||||
|
|
||||||
|
|
||||||
GLuint gldcGenTexture(void);
|
GLuint gldcGenTexture(void);
|
||||||
void gldcDeleteTexture(GLuint texture);
|
void gldcDeleteTexture(GLuint texture);
|
||||||
@ -28,9 +25,6 @@ void gldcBindTexture(GLuint texture);
|
|||||||
int gldcAllocTexture(int w, int h, int format);
|
int gldcAllocTexture(int w, int h, int format);
|
||||||
void gldcGetTexture(void** data, int* width, int* height);
|
void gldcGetTexture(void** data, int* width, int* height);
|
||||||
|
|
||||||
void glScissor( int x, int y, int width, int height);
|
|
||||||
void glViewport(int x, int y, int width, int height);
|
|
||||||
|
|
||||||
void glKosInit();
|
void glKosInit();
|
||||||
void glKosSwapBuffers();
|
void glKosSwapBuffers();
|
||||||
|
|
||||||
|
58
third_party/gldc/src/state.c
vendored
58
third_party/gldc/src/state.c
vendored
@ -5,25 +5,23 @@
|
|||||||
#include <dc/pvr.h>
|
#include <dc/pvr.h>
|
||||||
#include "gldc.h"
|
#include "gldc.h"
|
||||||
|
|
||||||
#define CLAMP( X, MAX ) ( (X) < 0 ? 0 : ((X)>(_MAX) ? (_MAX) : (X)) )
|
GLboolean STATE_DIRTY;
|
||||||
|
|
||||||
GLboolean STATE_DIRTY = GL_TRUE;
|
GLboolean DEPTH_TEST_ENABLED;
|
||||||
|
GLboolean DEPTH_MASK_ENABLED;
|
||||||
|
|
||||||
GLboolean DEPTH_TEST_ENABLED = GL_FALSE;
|
GLboolean CULLING_ENABLED;
|
||||||
GLboolean DEPTH_MASK_ENABLED = GL_FALSE;
|
|
||||||
|
|
||||||
GLboolean CULLING_ENABLED = GL_FALSE;
|
GLboolean FOG_ENABLED;
|
||||||
|
GLboolean ALPHA_TEST_ENABLED;
|
||||||
|
|
||||||
GLboolean FOG_ENABLED = GL_FALSE;
|
GLboolean SCISSOR_TEST_ENABLED;
|
||||||
GLboolean ALPHA_TEST_ENABLED = GL_FALSE;
|
|
||||||
|
|
||||||
GLboolean SCISSOR_TEST_ENABLED = GL_FALSE;
|
|
||||||
GLenum SHADE_MODEL = PVR_SHADE_GOURAUD;
|
GLenum SHADE_MODEL = PVR_SHADE_GOURAUD;
|
||||||
|
|
||||||
GLboolean BLEND_ENABLED = GL_FALSE;
|
GLboolean BLEND_ENABLED;
|
||||||
|
|
||||||
GLboolean TEXTURES_ENABLED = GL_FALSE;
|
GLboolean TEXTURES_ENABLED;
|
||||||
GLboolean AUTOSORT_ENABLED = GL_FALSE;
|
GLboolean AUTOSORT_ENABLED;
|
||||||
|
|
||||||
PolyList OP_LIST;
|
PolyList OP_LIST;
|
||||||
PolyList PT_LIST;
|
PolyList PT_LIST;
|
||||||
@ -67,40 +65,6 @@ void glKosSwapBuffers() {
|
|||||||
pvr_scene_finish();
|
pvr_scene_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void glScissor(int x, int y, int width, int height) {
|
|
||||||
pvr_poly_hdr_t c;
|
|
||||||
int sx = x, ex = x + width;
|
|
||||||
int sy = y, ey = y + height;
|
|
||||||
|
|
||||||
c.cmd = PVR_CMD_USERCLIP;
|
|
||||||
c.mode1 = c.mode2 = c.mode3 = 0;
|
|
||||||
|
|
||||||
int vw = vid_mode->width >> 5;
|
|
||||||
int vh = vid_mode->height >> 5;
|
|
||||||
|
|
||||||
c.d1 = CLAMP(sx >> 5, vw);
|
|
||||||
c.d2 = CLAMP(sy >> 5, vh);
|
|
||||||
c.d3 = CLAMP((ex >> 5) - 1, vw);
|
|
||||||
c.d4 = CLAMP((ey >> 5) - 1, vh);
|
|
||||||
|
|
||||||
aligned_vector_push_back(&OP_LIST.vector, &c, 1);
|
|
||||||
aligned_vector_push_back(&PT_LIST.vector, &c, 1);
|
|
||||||
aligned_vector_push_back(&TR_LIST.vector, &c, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void glViewport(int x, int y, int w, int h) {
|
|
||||||
Vertex c;
|
|
||||||
c.flags = PVR_CMD_USERCLIP | 0x23;
|
|
||||||
c.x = w * 0.5f; // hwidth
|
|
||||||
c.y = h * -0.5f; // hheight
|
|
||||||
c.z = x + w * 0.5f; // x_plus_hwidth
|
|
||||||
c.w = y + h * 0.5f; // y_plus_hheight
|
|
||||||
|
|
||||||
aligned_vector_push_back(&OP_LIST.vector, &c, 1);
|
|
||||||
aligned_vector_push_back(&PT_LIST.vector, &c, 1);
|
|
||||||
aligned_vector_push_back(&TR_LIST.vector, &c, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) {
|
void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) {
|
||||||
TextureObject* tx1 = TEXTURE_ACTIVE;
|
TextureObject* tx1 = TEXTURE_ACTIVE;
|
||||||
|
|
||||||
@ -175,7 +139,7 @@ void apply_poly_header(pvr_poly_hdr_t* dst, int list_type) {
|
|||||||
dst->mode2 |= (DimensionFlag(tx1->width) << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK;
|
dst->mode2 |= (DimensionFlag(tx1->width) << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK;
|
||||||
dst->mode2 |= (DimensionFlag(tx1->height) << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK;
|
dst->mode2 |= (DimensionFlag(tx1->height) << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK;
|
||||||
|
|
||||||
dst->mode3 = (GL_FALSE << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK;
|
dst->mode3 = (0 << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK;
|
||||||
dst->mode3 |= (tx1->color << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK;
|
dst->mode3 |= (tx1->color << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK;
|
||||||
dst->mode3 |= ((uint32_t)tx1->data & 0x00fffff8) >> 3;
|
dst->mode3 |= ((uint32_t)tx1->data & 0x00fffff8) >> 3;
|
||||||
}
|
}
|
||||||
|
2
third_party/gldc/src/texture.c
vendored
2
third_party/gldc/src/texture.c
vendored
@ -158,8 +158,6 @@ void gldcBindTexture(GLuint id) {
|
|||||||
|
|
||||||
TEXTURE_ACTIVE = txr;
|
TEXTURE_ACTIVE = txr;
|
||||||
gl_assert(TEXTURE_ACTIVE->index == id);
|
gl_assert(TEXTURE_ACTIVE->index == id);
|
||||||
|
|
||||||
STATE_DIRTY = GL_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gldcAllocTexture(int w, int h, int format) {
|
int gldcAllocTexture(int w, int h, int format) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user