somewhat working material system

This commit is contained in:
2026-02-06 15:43:22 +02:00
parent 7ac98cf9ba
commit 898bf90504
9 changed files with 140 additions and 17 deletions

View File

@@ -26,6 +26,7 @@ DECLARE_BUILD_STAGE(engine)
compileProject.includeDirectories = {
"../public",
"../external/SDL/include",
"../external/cglm/include",
FUNNYSTDLIB"public",
};
compileProject.bFPIC = true;

View File

@@ -6,6 +6,7 @@
#include "tier0/commandline.h"
#include "tier0/mem.h"
#include "sv_dll.h"
#include "cglm/cglm.h"
IRenderContext *g_pRenderContext;
IFileSystem *filesystem;
@@ -47,14 +48,15 @@ extern "C" void FunnyMain( int argc, char **argv )
IVertexBuffer *pVertices = NULL;
float vertices[18] = {
-0.5, -0.5, 0,
0.5, -0.5, 0,
-0.5, 0.5, 0,
-0.5, 0.5, 0,
0.5, -0.5, 0,
0.5, 0.5, 0
-0.5, -0.5, 0.5,
0.5, -0.5, 0.5,
-0.5, 0.5, 0.5,
-0.5, 0.5, 0.5,
0.5, -0.5, 0.5,
0.5, 0.5, 0.5
};
mat4 mat;
glm_mat4_identity(mat);
pVertices = g_pRenderContext->CreateVertexBuffer(72);
@@ -63,6 +65,9 @@ extern "C" void FunnyMain( int argc, char **argv )
pVertices->Unmap();
pCameraInfoBuffer = g_pRenderContext->CreateConstantBuffer(64);
pMapped = pCameraInfoBuffer->Map();
V_memcpy(pMapped, mat, 64);
pCameraInfoBuffer->Unmap();
pShader = g_pRenderContext->CreateShader("game/core/shaders/flat.shader_c");
pShader->AddLayout(0, 12);