summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/AssetManager.cpp10
-rw-r--r--src/RendererEntity.cpp2
-rw-r--r--src/RendererSectionData.cpp4
-rw-r--r--src/RendererWorld.cpp4
4 files changed, 12 insertions, 8 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp
index aa796b8..03a672e 100644
--- a/src/AssetManager.cpp
+++ b/src/AssetManager.cpp
@@ -352,7 +352,7 @@ void ParseBlockModels() {
VectorF elementSize(VectorF(t.x, t.y, t.z) / 16.0f);
VectorF elementOrigin(VectorF(element.from.x, element.from.y, element.from.z) / 16.0f);
- glm::mat4 elementTransform;
+ glm::mat4 elementTransform = glm::mat4(1.0);
if (element.rotationAngle != 0) {
static const glm::vec3 xAxis(1.0f, 0.0f, 0.0f);
@@ -374,7 +374,7 @@ void ParseBlockModels() {
VectorF rotateOrigin(VectorF(element.rotationOrigin.x, element.rotationOrigin.y, element.rotationOrigin.z) / 16.0f);
- glm::mat4 rotationMat;
+ glm::mat4 rotationMat = glm::mat4(1.0);
rotationMat = glm::translate(rotationMat, rotateOrigin.glm());
rotationMat = glm::rotate(rotationMat, glm::radians((float)element.rotationAngle), *targetAxis);
@@ -410,7 +410,7 @@ void ParseBlockModels() {
ParsedFace parsedFace;
parsedFace.visibility = face.second.cullface;
- glm::mat4 faceTransform;
+ glm::mat4 faceTransform = glm::mat4(1.0);
switch (face.first) {
case FaceDirection::down:
faceTransform = glm::translate(elementTransform, glm::vec3(0, 0, 0));
@@ -512,6 +512,7 @@ BlockFaces &AssetManager::GetBlockModelByBlockId(BlockId block) {
if (block.id == 7788) {
BlockFaces blockFaces;
+ blockFaces.transform = glm::mat4(1.0);
blockFaces.faces = GetAsset<AssetBlockModel>("/minecraft/models/block/error")->blockModel.parsedFaces;
blockFaces.isBlock = GetAsset<AssetBlockModel>("/minecraft/models/block/error")->blockModel.IsBlock;
for (int i = 0; i < FaceDirection::none; i++) {
@@ -540,9 +541,10 @@ BlockFaces &AssetManager::GetBlockModelByBlockId(BlockId block) {
return GetBlockModelByBlockId(BlockId{ 7788,0 });
BlockFaces blockFaces;
+ blockFaces.transform = glm::mat4(1.0);
blockFaces.faces = assetModel->blockModel.parsedFaces;
blockFaces.isBlock = assetModel->blockModel.IsBlock;
- glm::mat4 transform;
+ glm::mat4 transform = glm::mat4(1.0);
if (model.y != 0) {
blockFaces.transform = glm::translate(blockFaces.transform, glm::vec3(0.5f, 0.0f, 0.5f));
diff --git a/src/RendererEntity.cpp b/src/RendererEntity.cpp
index 951b1ad..a987139 100644
--- a/src/RendererEntity.cpp
+++ b/src/RendererEntity.cpp
@@ -145,7 +145,7 @@ RendererEntity::~RendererEntity() {
void RendererEntity::Render(RenderState & renderState) {
renderState.SetActiveVao(Vao);
- glm::mat4 model;
+ glm::mat4 model = glm::mat4(1.0);
Entity& entity = world->GetEntity(entityId);
model = glm::translate(model, entity.pos.glm());
model = glm::translate(model, glm::vec3(0, entity.height / 2.0, 0));
diff --git a/src/RendererSectionData.cpp b/src/RendererSectionData.cpp
index 1cbb4e9..e72a369 100644
--- a/src/RendererSectionData.cpp
+++ b/src/RendererSectionData.cpp
@@ -29,6 +29,8 @@ void AddFacesByBlockModel(RendererSectionData &data, const BlockFaces &model, co
break;
}
}
+ if (faceDirection == FaceDirection::none)
+ continue;
if (visibility[faceDirection])
continue;
@@ -110,7 +112,7 @@ RendererSectionData ParseSection(const SectionsData &sections)
data.hash = sections.section.GetHash();
data.sectionPos = sections.section.GetPosition();
- glm::mat4 baseOffset = glm::translate(glm::mat4(), (sections.section.GetPosition() * 16).glm()), transform;
+ glm::mat4 baseOffset = glm::translate(glm::mat4(1.0), (sections.section.GetPosition() * 16).glm()), transform;
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp
index 023ac32..d91ea0e 100644
--- a/src/RendererWorld.cpp
+++ b/src/RendererWorld.cpp
@@ -304,7 +304,7 @@ void RendererWorld::Render(RenderState & renderState) {
if (selectedBlock != Vector()) {
glLineWidth(2.0f);
{
- glm::mat4 model;
+ glm::mat4 model = glm::mat4(1.0);
model = glm::translate(model, selectedBlock.glm());
model = glm::translate(model,glm::vec3(0.5f,0.5f,0.5f));
model = glm::scale(model,glm::vec3(1.01f,1.01f,1.01f));
@@ -345,7 +345,7 @@ void RendererWorld::Render(RenderState & renderState) {
viewLoc = glGetUniformLocation(skyShader->Program, "view");
glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
- glm::mat4 model = glm::mat4();
+ glm::mat4 model = glm::mat4(1.0);
model = glm::translate(model, gs->player->pos.glm());
const float scale = 1000000.0f;
model = glm::scale(model, glm::vec3(scale, scale, scale));