Better Studs

This commit is contained in:
maelstrom 2024-11-19 23:58:32 +01:00
parent 9b06763cfb
commit a36407c75e
7 changed files with 15 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 19 KiB

BIN
assets/textures/studs.psd Normal file

Binary file not shown.

BIN
assets/textures/studs.xcf Normal file

Binary file not shown.

BIN
assets/textures/studs1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -15,6 +15,7 @@
#include "../camera.h"
#include "../part.h"
#include "skybox.h"
#include "surface.h"
#include "texture3d.h"
#include "renderer.h"
@ -46,7 +47,7 @@ void renderInit(GLFWwindow* window) {
"assets/textures/skybox/null_plainsky512_bk.jpg",
}, GL_RGB);
studsTexture = new Texture3D("assets/textures/studs.png", 64, 64, 6, GL_RGBA);
studsTexture = new Texture3D("assets/textures/studs.png", 128, 128, 6, GL_RGBA);
// Compile shader
shader = new Shader("assets/shaders/phong.vs", "assets/shaders/phong.fs");
@ -90,8 +91,9 @@ void renderParts() {
// });
studsTexture->activate(0);
shader->set("studs", 0);
shader->set("surfaces[1]", 3);
shader->set("surfaces[4]", 4);
// shader->set("surfaces[1]", SurfaceStuds);
shader->set("surfaces[1]", SurfaceStuds);
shader->set("surfaces[4]", SurfaceInlets);
// Pre-calculate the normal matrix for the shader

10
src/rendering/surface.h Normal file
View file

@ -0,0 +1,10 @@
#pragma once
enum SurfaceType {
SurfaceSmooth = 0,
SurfaceGlue = 1,
SurfaceWeld = 2,
SurfaceStuds = 3,
SurfaceInlets = 4,
SurfaceUniversal = 5,
};