add face culling
This commit is contained in:
@@ -50,8 +50,10 @@ bool Renderer::Init() {
|
|||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDepthFunc(GL_LESS);
|
glDepthFunc(GL_LESS);
|
||||||
|
glFrontFace(GL_CW);
|
||||||
InitShaders();
|
InitShaders();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,12 +71,12 @@ GL::VertexArray LoadWorldModel(const td::game::World* world) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
positions.insert(positions.end(), {
|
positions.insert(positions.end(), {
|
||||||
static_cast<float>(chunkX + tileX), 0, static_cast<float>(chunkY + tileY),
|
static_cast<float>(chunkX + tileX), 0, static_cast<float>(chunkY + tileY),
|
||||||
static_cast<float>(chunkX + tileX + 1), 0, static_cast<float>(chunkY + tileY),
|
static_cast<float>(chunkX + tileX + 1), 0, static_cast<float>(chunkY + tileY),
|
||||||
static_cast<float>(chunkX + tileX), 0, static_cast<float>(chunkY + tileY + 1),
|
static_cast<float>(chunkX + tileX), 0, static_cast<float>(chunkY + tileY + 1),
|
||||||
|
|
||||||
static_cast<float>(chunkX + tileX + 1), 0, static_cast<float>(chunkY + tileY),
|
static_cast<float>(chunkX + tileX), 0, static_cast<float>(chunkY + tileY + 1),
|
||||||
static_cast<float>(chunkX + tileX), 0, static_cast<float>(chunkY + tileY + 1),
|
static_cast<float>(chunkX + tileX + 1), 0, static_cast<float>(chunkY + tileY),
|
||||||
static_cast<float>(chunkX + tileX + 1), 0, static_cast<float>(chunkY + tileY + 1)
|
static_cast<float>(chunkX + tileX + 1), 0, static_cast<float>(chunkY + tileY + 1)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,8 +103,8 @@ GL::VertexArray LoadWorldModel(const td::game::World* world) {
|
|||||||
float fromY = spawn.GetTopLeft().GetY(), toY = spawn.GetBottomRight().GetY();
|
float fromY = spawn.GetTopLeft().GetY(), toY = spawn.GetBottomRight().GetY();
|
||||||
|
|
||||||
positions.insert(positions.end(), {
|
positions.insert(positions.end(), {
|
||||||
fromX, 0, fromY,
|
|
||||||
fromX, 0, toY,
|
fromX, 0, toY,
|
||||||
|
fromX, 0, fromY,
|
||||||
toX, 0, fromY,
|
toX, 0, fromY,
|
||||||
|
|
||||||
toX, 0, toY,
|
toX, 0, toY,
|
||||||
@@ -131,8 +131,8 @@ GL::VertexArray LoadWorldModel(const td::game::World* world) {
|
|||||||
float fromY = castle.GetTopLeft().GetY(), toY = castle.GetBottomRight().GetY();
|
float fromY = castle.GetTopLeft().GetY(), toY = castle.GetBottomRight().GetY();
|
||||||
|
|
||||||
positions.insert(positions.end(), {
|
positions.insert(positions.end(), {
|
||||||
fromX, 0, fromY,
|
|
||||||
fromX, 0, toY,
|
fromX, 0, toY,
|
||||||
|
fromX, 0, fromY,
|
||||||
toX, 0, fromY,
|
toX, 0, fromY,
|
||||||
|
|
||||||
toX, 0, toY,
|
toX, 0, toY,
|
||||||
@@ -168,13 +168,13 @@ GL::VertexArray LoadWorldModel(const td::game::World* world) {
|
|||||||
|
|
||||||
GL::VertexArray LoadTileSelectModel() {
|
GL::VertexArray LoadTileSelectModel() {
|
||||||
std::vector<float> positions = {
|
std::vector<float> positions = {
|
||||||
0, 0, 0,
|
0, .01, 0,
|
||||||
1, 0, 0,
|
1, .01, 0,
|
||||||
0, 0, 1,
|
0, .01, 1,
|
||||||
|
|
||||||
1, 0, 0,
|
0, .01, 1,
|
||||||
0, 0, 1,
|
1, .01, 0,
|
||||||
1, 0, 1
|
1, .01, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
int color = 255 << 24 | 255 << 16 | 255 << 8 | 150;
|
int color = 255 << 24 | 255 << 16 | 255 << 8 | 150;
|
||||||
|
|||||||
Reference in New Issue
Block a user