Add OpenGLCommandList

This commit is contained in:
2026-03-16 18:35:02 +08:00
parent 0be91748c2
commit fce3d2421c
3 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
#pragma once
#include <GLFW/glfw3.h>
#include <vector>
namespace XCEngine {
namespace RHI {
class OpenGLBuffer;
class OpenGLVertexArray;
class OpenGLShader;
class OpenGLTexture;
enum class PrimitiveType {
Points,
Lines,
LineStrip,
Triangles,
TriangleStrip,
TriangleFan
};
class OpenGLCommandList {
public:
OpenGLCommandList();
~OpenGLCommandList();
void Clear(float r, float g, float b, float a, unsigned int buffers);
void SetPipelineState(void* pipelineState);
void SetVertexBuffer(unsigned int buffer, size_t offset, size_t stride);
void SetIndexBuffer(unsigned int buffer, unsigned int type);
void Draw(PrimitiveType type, unsigned int vertexCount, unsigned int startVertex);
void DrawIndexed(PrimitiveType type, unsigned int indexCount, unsigned int startIndex, int baseVertex);
void BindVertexArray(unsigned int vao);
void UseShader(unsigned int program);
void SetViewport(int x, int y, int width, int height);
private:
unsigned int m_primitiveType;
unsigned int m_currentVAO;
unsigned int m_currentProgram;
};
} // namespace RHI
} // namespace XCEngine