mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Add (low level) functionality to allow rendering 3D Meshes.
- Add love.graphics.setDepthMode(testcomparison, enablewrites). - Add love.graphics.setMeshCullMode. - Add love.graphics.setFrontFaceWinding. Depth testing and depth writes require a depth buffer to work. The mesh cull mode controls whether front/back faces of a mesh are culled. The front face winding determines whether a clockwise or counterclockwise-oriented face in a mesh is considered front facing. --HG-- branch : minor
This commit is contained in:
@@ -92,6 +92,16 @@ public:
|
||||
FRAMEBUFFER_ALL = (FRAMEBUFFER_READ | FRAMEBUFFER_DRAW),
|
||||
};
|
||||
|
||||
enum EnableState
|
||||
{
|
||||
ENABLE_DEPTH_TEST,
|
||||
ENABLE_STENCIL_TEST,
|
||||
ENABLE_SCISSOR_TEST,
|
||||
ENABLE_FACE_CULL,
|
||||
ENABLE_FRAMEBUFFER_SRGB,
|
||||
ENABLE_MAX_ENUM
|
||||
};
|
||||
|
||||
struct TextureFormat
|
||||
{
|
||||
GLenum internalformat = 0;
|
||||
@@ -204,6 +214,11 @@ public:
|
||||
**/
|
||||
void setVertexAttributes(const vertex::Attributes &attributes, const vertex::Buffers &buffers);
|
||||
|
||||
/**
|
||||
* Wrapper for glCullFace which eliminates redundant state setting.
|
||||
**/
|
||||
void setCullMode(CullMode mode);
|
||||
|
||||
/**
|
||||
* Wrapper for glClearDepth and glClearDepthf.
|
||||
**/
|
||||
@@ -236,10 +251,10 @@ public:
|
||||
float getPointSize() const;
|
||||
|
||||
/**
|
||||
* Calls glEnable/glDisable(GL_FRAMEBUFFER_SRGB).
|
||||
* State-tracked version of glEnable.
|
||||
**/
|
||||
void setFramebufferSRGB(bool enable);
|
||||
bool hasFramebufferSRGB() const;
|
||||
void setEnableState(EnableState state, bool enable);
|
||||
bool isStateEnabled(EnableState state) const;
|
||||
|
||||
/**
|
||||
* Binds a Framebuffer Object to the specified target.
|
||||
@@ -250,6 +265,12 @@ public:
|
||||
|
||||
void framebufferTexture(GLenum attachment, TextureType texType, GLuint texture, int level, int layer = 0, int face = 0);
|
||||
|
||||
/**
|
||||
* Calls glDepthMask.
|
||||
**/
|
||||
void setDepthWrites(bool enable);
|
||||
bool hasDepthWrites() const;
|
||||
|
||||
/**
|
||||
* Calls glUseProgram.
|
||||
**/
|
||||
@@ -415,7 +436,10 @@ private:
|
||||
// Texture unit state (currently bound texture for each texture unit.)
|
||||
std::vector<GLuint> boundTextures[TEXTURE_MAX_ENUM];
|
||||
|
||||
// Currently active texture unit.
|
||||
bool enableState[ENABLE_MAX_ENUM];
|
||||
|
||||
GLenum faceCullMode;
|
||||
|
||||
int curTextureUnit;
|
||||
|
||||
uint32 enabledAttribArrays;
|
||||
@@ -429,9 +453,9 @@ private:
|
||||
|
||||
float pointSize;
|
||||
|
||||
GLuint boundFramebuffers[2];
|
||||
bool depthWritesEnabled;
|
||||
|
||||
bool framebufferSRGBEnabled;
|
||||
GLuint boundFramebuffers[2];
|
||||
|
||||
GLuint defaultTexture[TEXTURE_MAX_ENUM];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user