introduces ios support? still needs metal
This commit is contained in:
@@ -30,7 +30,7 @@ void CBrushEntity::Spawn()
|
||||
}
|
||||
/* use them */
|
||||
px_collider_params params = {};
|
||||
params.friction = 0.6;
|
||||
params.friction = 0.0;
|
||||
m_collider = px_trimesh((Point<float>*)triangles.GetMemory(), triangles.GetSize(), (uint32_t(*)[3])indicies.GetMemory(), indicies.GetSize()/3 ,params);
|
||||
px_fixedbody(px, m_collider);
|
||||
};
|
||||
@@ -65,10 +65,11 @@ void C_BrushEntity::Spawn()
|
||||
float uv[2];
|
||||
};
|
||||
|
||||
pAlbedo = ITextureManager::LoadTexture("textures/bricks.png");
|
||||
CBrushEntity* pBrushEntity = (CBrushEntity*)pEntity;
|
||||
uint32_t numVertices = 15*pBrushEntity->m_mesh.GetSize();
|
||||
|
||||
vertexBuffer = IRenderer::CreateVertexBuffer(numVertices*4);
|
||||
|
||||
Vertex_t *pTriangles = (Vertex_t*)vertexBuffer->Map();
|
||||
uint32_t i = 0;
|
||||
for (auto &triangle: pBrushEntity->m_mesh)
|
||||
@@ -91,10 +92,6 @@ void C_BrushEntity::Spawn()
|
||||
i+=3;
|
||||
}
|
||||
vertexBuffer->Unmap();
|
||||
|
||||
mesh = IMeshRenderer::CreateMesh();
|
||||
mesh->SetVertexBuffer(vertexBuffer);
|
||||
|
||||
};
|
||||
|
||||
void C_BrushEntity::Destroy()
|
||||
@@ -103,7 +100,6 @@ void C_BrushEntity::Destroy()
|
||||
}
|
||||
void C_BrushEntity::Think( float fDelta )
|
||||
{
|
||||
material.m.albedo = ITextureManager::GetTexture(pAlbedo);
|
||||
mat4 matrix;
|
||||
glm_mat4_zero(matrix);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
@@ -113,8 +109,48 @@ void C_BrushEntity::Think( float fDelta )
|
||||
matrix[3][0] = pEntity->m_position[0];
|
||||
matrix[3][1] = pEntity->m_position[1];
|
||||
matrix[3][2] = pEntity->m_position[2];
|
||||
mesh->SetMatrix(matrix);
|
||||
mesh->SetMaterial(&material);
|
||||
mesh->Draw();
|
||||
};
|
||||
|
||||
IGraphicsPipeline *g_BrushPipeline;
|
||||
|
||||
class CBrushRendering: public IRenderingPipelineStep
|
||||
{
|
||||
public:
|
||||
virtual void Init() override;
|
||||
virtual void Frame( float fDelta ) override;
|
||||
virtual void Deinit() override;
|
||||
private:
|
||||
};
|
||||
DECLARE_MESH_RENDERING_STAGE(CBrushRendering, brush_rasterizer);
|
||||
|
||||
CUtlVector<IVertexBuffer*> g_BrushVertices;
|
||||
|
||||
void CBrushRendering::Init()
|
||||
{
|
||||
V_printf("cool\n");
|
||||
IRenderer::CreateGraphicsPipeline(
|
||||
{
|
||||
{"shaders/brush_vert.spv", SHADER_TYPE_VERTEX},
|
||||
{"shaders/brush_frag.spv", SHADER_TYPE_FRAGMENT},
|
||||
},
|
||||
{}, 64,
|
||||
{EImageFormat::IMAGE_FORMAT_R8G8B8A8}
|
||||
);
|
||||
};
|
||||
|
||||
void CBrushRendering::Frame( float fDelta )
|
||||
{
|
||||
V_printf("cooll\n");
|
||||
IRenderer::ResetState();
|
||||
IRenderer::SetDepthMode(DEPTH_MODE_LESS_EQUAL);
|
||||
IRenderer::BindPipeline(g_BrushPipeline);
|
||||
for (auto &vertices: g_BrushVertices)
|
||||
{
|
||||
IRenderer::Draw(vertices, 0);
|
||||
}
|
||||
};
|
||||
|
||||
void CBrushRendering::Deinit()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user