Remove IAMath

This commit is contained in:
Isuru Samarathunga
2025-09-13 14:55:15 +05:30
parent 50f3f14c47
commit 62edc71750
12 changed files with 44 additions and 29 deletions

4
.gitmodules vendored
View File

@ -11,7 +11,3 @@
path = Dependencies/IACore path = Dependencies/IACore
url = https://git.iasoft.dev/dev0/IACore url = https://git.iasoft.dev/dev0/IACore
branch = main branch = main
[submodule "Dependencies/IAMath"]
path = Dependencies/IAMath
url = https://git.iasoft.dev/dev0/IAMath
branch = main

View File

@ -14,7 +14,6 @@ add_compile_definitions("__IA_DEBUG=1")
add_subdirectory(Vendor/) add_subdirectory(Vendor/)
add_subdirectory(Dependencies/IACore) add_subdirectory(Dependencies/IACore)
add_subdirectory(Dependencies/IAMath)
add_subdirectory(Src/IAEngine) add_subdirectory(Src/IAEngine)
add_subdirectory(Src/IAESandbox) add_subdirectory(Src/IAESandbox)

1
Dependencies/IAMath vendored

Submodule Dependencies/IAMath deleted from 450d6b4ecc

View File

@ -36,6 +36,6 @@ namespace ia::iae::game
VOID Game::Update() VOID Game::Update()
{ {
g_tex->Draw({}, {}, {}, false, false, {}); g_tex->Draw({}, {1.0f, 1.0f, 1.0f}, 0.0f, false, false, {1.0f, 1.0f, 1.0f, 1.0f});
} }
} }

View File

@ -40,5 +40,5 @@ add_library(IAEngine STATIC ${IAEngine_Sources})
target_include_directories(IAEngine PUBLIC inc/) target_include_directories(IAEngine PUBLIC inc/)
target_include_directories(IAEngine PRIVATE imp/hpp) target_include_directories(IAEngine PRIVATE imp/hpp)
target_link_libraries(IAEngine PUBLIC IACore IAMath ImGui) target_link_libraries(IAEngine PUBLIC IACore ImGui)
target_link_libraries(IAEngine PRIVATE SDL3::SDL3 SDL3_mixer::SDL3_mixer) target_link_libraries(IAEngine PRIVATE SDL3::SDL3 SDL3_mixer::SDL3_mixer)

View File

@ -35,8 +35,8 @@ namespace ia::iae
{ {
const auto res = MakeRefPtr<Pipeline_UnlitMesh>(); const auto res = MakeRefPtr<Pipeline_UnlitMesh>();
const auto vertexShader = LoadShaderFromMemory(ShaderStage::VERTEX, SHADER_SOURCE_UNLITMESH_VERT, sizeof(SHADER_SOURCE_UNLITMESH_VERT), 0, 0, 0, 0); const auto vertexShader = LoadShaderFromMemory(ShaderStage::VERTEX, SHADER_SOURCE_UNLITMESH_VERT, sizeof(SHADER_SOURCE_UNLITMESH_VERT), 0, 1, 0, 0);
const auto pixelShader = LoadShaderFromMemory(ShaderStage::PIXEL, SHADER_SOURCE_UNLITMESH_FRAG, sizeof(SHADER_SOURCE_UNLITMESH_FRAG), 1, 0, 0, 0); const auto pixelShader = LoadShaderFromMemory(ShaderStage::PIXEL, SHADER_SOURCE_UNLITMESH_FRAG, sizeof(SHADER_SOURCE_UNLITMESH_FRAG), 1, 1, 0, 0);
SDL_GPUColorTargetDescription colorTargets[] = { SDL_GPUColorTargetDescription colorTargets[] = {
{.format = SDL_GetGPUSwapchainTextureFormat(g_gpuDevice, g_windowHandle)}}; {.format = SDL_GetGPUSwapchainTextureFormat(g_gpuDevice, g_windowHandle)}};

View File

@ -179,23 +179,30 @@ namespace ia::iae
SDL_SubmitGPUCommandBuffer(g_cmdBuffer); SDL_SubmitGPUCommandBuffer(g_cmdBuffer);
} }
VOID Renderer::BindTexture(IN Handle handle, IN INT32 index) VOID Renderer::BindTexture(IN Handle handle, IN BOOL flipV, IN BOOL flipH, IN CONST iam::Vec4f &colorOverlay)
{ {
SDL_GPUTextureSamplerBinding binding { STATIC struct
.texture = (SDL_GPUTexture*)handle, {
.sampler = (SDL_GPUSampler*)GPUTexture::GetDefaultSampler() iam::Vec4f colorOverlay;
}; UINT32 flipV;
SDL_BindGPUFragmentSamplers(g_renderPass, index, &binding, 1); UINT32 flipH;
} textureState;
textureState = {colorOverlay, flipV, flipH};
SDL_GPUTextureSamplerBinding binding{.texture = (SDL_GPUTexture *) handle,
.sampler = (SDL_GPUSampler *) GPUTexture::GetDefaultSampler()};
SDL_BindGPUFragmentSamplers(g_renderPass, 0, &binding, 1);
SDL_PushGPUFragmentUniformData(g_cmdBuffer, 0, &textureState, sizeof(textureState));
} }
VOID Renderer::Draw(IN Handle vertexBufferHandle, IN INT32 vertexCount) VOID Renderer::Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN INT32 vertexCount)
{ {
SDL_GPUBufferBinding bindings[] = {{.buffer = (SDL_GPUBuffer *) vertexBufferHandle, .offset = 0}}; SDL_GPUBufferBinding bindings[] = {{.buffer = (SDL_GPUBuffer *) vertexBufferHandle, .offset = 0}};
SDL_BindGPUVertexBuffers(g_renderPass, 0, bindings, 1); SDL_BindGPUVertexBuffers(g_renderPass, 0, bindings, 1);
SDL_DrawGPUPrimitives(g_renderPass, vertexCount, 1, 0, 0); SDL_DrawGPUPrimitives(g_renderPass, vertexCount, 1, 0, 0);
} }
VOID Renderer::Draw(IN Handle vertexBufferHandle, IN Handle indexBufferHandle, IN INT32 indexCount) VOID Renderer::Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN Handle indexBufferHandle, IN INT32 indexCount)
{ {
SDL_GPUBufferBinding bindings[] = {{.buffer = (SDL_GPUBuffer *) vertexBufferHandle, .offset = 0}, SDL_GPUBufferBinding bindings[] = {{.buffer = (SDL_GPUBuffer *) vertexBufferHandle, .offset = 0},
{.buffer = (SDL_GPUBuffer *) indexBufferHandle, .offset = 0}}; {.buffer = (SDL_GPUBuffer *) indexBufferHandle, .offset = 0}};

View File

@ -34,7 +34,7 @@ namespace ia::iae
VOID Texture::Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN BOOL flipH, VOID Texture::Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN BOOL flipH,
IN BOOL flipV, IN CONST iam::Vec4f &colorOverlay) CONST IN BOOL flipV, IN CONST iam::Vec4f &colorOverlay) CONST
{ {
Renderer::BindTexture(m_handle, 0); Renderer::BindTexture(m_handle, flipV, flipH, colorOverlay);
QuadMesh::Draw(position, m_size * scale, rotation); QuadMesh::Draw(position, m_size * scale, rotation);
} }
} // namespace ia::iae } // namespace ia::iae

View File

@ -6,8 +6,16 @@ layout(location = 0) in vec2 inTexCoord;
layout(location = 0) out vec4 outColor; layout(location = 0) out vec4 outColor;
layout(set = 2, binding = 0) uniform sampler2D texSampler; layout(set = 2, binding = 0) uniform sampler2D texSampler;
layout(set = 3, binding = 0) uniform UniformBufferObject {
vec4 colorOverlay;
bool flipV;
bool flipH;
} ubo;
void main() void main()
{ {
outColor = texture(texSampler, inTexCoord); vec2 uv = inTexCoord;
if(ubo.flipH) uv.x = 1 - uv.x;
if(ubo.flipV) uv.y = 1 - uv.y;
outColor = texture(texSampler, uv) * ubo.colorOverlay;
} }

View File

@ -2,12 +2,18 @@
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
layout (location = 0) in vec3 inPosition; layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec2 inTexcCoord; layout (location = 1) in vec2 inTexCoord;
layout(location = 0) out vec2 outTexCoord; layout(location = 0) out vec2 outTexCoord;
layout(set = 1, binding = 0) uniform UniformBufferObject {
mat4 model;
mat4 view;
mat4 proj;
} ubo;
void main() void main()
{ {
gl_Position = vec4(inPosition, 1.0f); gl_Position = vec4(inPosition, 1.0f);
outTexCoord = inTexcCoord; outTexCoord = inTexCoord;
} }

File diff suppressed because one or more lines are too long

View File

@ -44,10 +44,10 @@ namespace ia::iae
STATIC VOID BeginFrame(); STATIC VOID BeginFrame();
STATIC VOID EndFrame(); STATIC VOID EndFrame();
STATIC VOID BindTexture(IN Handle handle, IN INT32 index); STATIC VOID BindTexture(IN Handle handle, IN BOOL flipV, IN BOOL flipH, IN CONST iam::Vec4f& colorOverlay);
STATIC VOID Draw(IN Handle vertexBufferHandle, IN INT32 vertexCount); STATIC VOID Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN INT32 vertexCount);
STATIC VOID Draw(IN Handle vertexBufferHandle, IN Handle indexBufferHandle, IN INT32 indexCount); STATIC VOID Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN Handle vertexBufferHandle, IN Handle indexBufferHandle, IN INT32 indexCount);
public: public:
STATIC INT32 Width() STATIC INT32 Width()