mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-20 06:01:16 +00:00
update gxm renderer with interface changes
This commit is contained in:
parent
3c9c35538c
commit
35ee36d50e
@ -1560,7 +1560,7 @@ void GXMRenderer::Flip()
|
|||||||
gxm->swap_display();
|
gxm->swap_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GXMRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect)
|
void GXMRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect, FColor color)
|
||||||
{
|
{
|
||||||
this->StartScene();
|
this->StartScene();
|
||||||
|
|
||||||
@ -1569,7 +1569,11 @@ void GXMRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const S
|
|||||||
sceGxmPushUserMarker(gxm->context, marker);
|
sceGxmPushUserMarker(gxm->context, marker);
|
||||||
|
|
||||||
sceGxmSetVertexProgram(gxm->context, this->mainVertexProgram);
|
sceGxmSetVertexProgram(gxm->context, this->mainVertexProgram);
|
||||||
sceGxmSetFragmentProgram(gxm->context, this->imageFragmentProgram);
|
if(textureId != NO_TEXTURE_ID) {
|
||||||
|
sceGxmSetFragmentProgram(gxm->context, this->imageFragmentProgram);
|
||||||
|
} else {
|
||||||
|
sceGxmSetFragmentProgram(gxm->context, gxm->clearFragmentProgram);
|
||||||
|
}
|
||||||
|
|
||||||
void* vertUniforms;
|
void* vertUniforms;
|
||||||
void* fragUniforms;
|
void* fragUniforms;
|
||||||
@ -1596,7 +1600,11 @@ void GXMRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const S
|
|||||||
|
|
||||||
D3DRMMATRIX4D projection;
|
D3DRMMATRIX4D projection;
|
||||||
CreateOrthoMatrix(0.0, 1.0, 1.0, 0.0, projection);
|
CreateOrthoMatrix(0.0, 1.0, 1.0, 0.0, projection);
|
||||||
static const Matrix3x3 normal = {{1.f, 0.f, 0.f}, {0.f, 1.f, 0.f}, {0.f, 0.f, 1.f}};
|
static const Matrix3x3 normal = {
|
||||||
|
{1.f, 0.f, 0.f},
|
||||||
|
{0.f, 1.f, 0.f},
|
||||||
|
{0.f, 0.f, 1.f}
|
||||||
|
};
|
||||||
|
|
||||||
D3DRMMATRIX4D identity;
|
D3DRMMATRIX4D identity;
|
||||||
memset(identity, 0, sizeof(identity));
|
memset(identity, 0, sizeof(identity));
|
||||||
@ -1609,15 +1617,24 @@ void GXMRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const S
|
|||||||
SET_UNIFORM(vertUniforms, this->uNormalMatrix, normal); // float3x3
|
SET_UNIFORM(vertUniforms, this->uNormalMatrix, normal); // float3x3
|
||||||
SET_UNIFORM(vertUniforms, this->uProjectionMatrix, projection); // float4x4
|
SET_UNIFORM(vertUniforms, this->uProjectionMatrix, projection); // float4x4
|
||||||
|
|
||||||
GXMTextureCacheEntry& texture = m_textures[textureId];
|
float u1 = 0.0;
|
||||||
const SceGxmTexture* gxmTexture = this->UseTexture(texture);
|
float v1 = 0.0;
|
||||||
float texW = sceGxmTextureGetWidth(gxmTexture);
|
float u2 = 0.0;
|
||||||
float texH = sceGxmTextureGetHeight(gxmTexture);
|
float v2 = 0.0;
|
||||||
|
|
||||||
float u1 = static_cast<float>(srcRect.x) / texW;
|
if(textureId != NO_TEXTURE_ID) {
|
||||||
float v1 = static_cast<float>(srcRect.y) / texH;
|
GXMTextureCacheEntry& texture = m_textures[textureId];
|
||||||
float u2 = static_cast<float>(srcRect.x + srcRect.w) / texW;
|
const SceGxmTexture* gxmTexture = this->UseTexture(texture);
|
||||||
float v2 = static_cast<float>(srcRect.y + srcRect.h) / texH;
|
float texW = sceGxmTextureGetWidth(gxmTexture);
|
||||||
|
float texH = sceGxmTextureGetHeight(gxmTexture);
|
||||||
|
|
||||||
|
u1 = static_cast<float>(srcRect.x) / texW;
|
||||||
|
v1 = static_cast<float>(srcRect.y) / texH;
|
||||||
|
u2 = static_cast<float>(srcRect.x + srcRect.w) / texW;
|
||||||
|
v2 = static_cast<float>(srcRect.y + srcRect.h) / texH;
|
||||||
|
} else {
|
||||||
|
SET_UNIFORM(fragUniforms, gxm->clear_uColor, color);
|
||||||
|
}
|
||||||
|
|
||||||
Vertex* quadVertices = this->QuadVerticesBuffer();
|
Vertex* quadVertices = this->QuadVerticesBuffer();
|
||||||
quadVertices[0] = Vertex{.position = {x1, y1, 0}, .normal = {0, 0, 0}, .texCoord = {u1, v1}};
|
quadVertices[0] = Vertex{.position = {x1, y1, 0}, .normal = {0, 0, 0}, .texCoord = {u1, v1}};
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class GXMRenderer : public Direct3DRMRenderer {
|
|||||||
void Resize(int width, int height, const ViewportTransform& viewportTransform) override;
|
void Resize(int width, int height, const ViewportTransform& viewportTransform) override;
|
||||||
void Clear(float r, float g, float b) override;
|
void Clear(float r, float g, float b) override;
|
||||||
void Flip() override;
|
void Flip() override;
|
||||||
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
|
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect, FColor color) override;
|
||||||
void Download(SDL_Surface* target) override;
|
void Download(SDL_Surface* target) override;
|
||||||
void SetDither(bool dither) override;
|
void SetDither(bool dither) override;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user