stuff
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "tFunctions.h"
|
||||
#include "Vertex.h"
|
||||
#include "texture.h"
|
||||
#include "SurfaceTexture.h"
|
||||
#include "MeshData.h"
|
||||
|
||||
struct IntersectionData {
|
||||
@@ -36,11 +37,12 @@ class Mesh : public Object , public Renderable, public t_package , public MeshDa
|
||||
friend class Model;
|
||||
protected:
|
||||
public:
|
||||
Texture* meshTexture = nullptr;
|
||||
SurfaceTexture surface;
|
||||
glm::vec4 colorOverride = glm::vec4(0.0f); // rgb + strength; 0 = use the texture's own colour
|
||||
float metallic = 0.0f;
|
||||
float roughness = 0.8f;
|
||||
float ao = 1.0f;
|
||||
float emissive = 0.0f; // 0-1, how much of its own colour it shows with no light on it
|
||||
|
||||
VAO vao;
|
||||
VBO vbo;
|
||||
@@ -461,26 +463,24 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Vertices are normalized into the unit cube, so t's box already holds the whole mesh
|
||||
bool GetWorldBounds(BoundingBox& bounds) const override {
|
||||
bounds = t.GetAABB();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Render(Shader& ShaderProgram) override {
|
||||
glm::mat4 topass = t.GetMatrix();
|
||||
|
||||
ShaderProgram.Activate();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (meshTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, meshTexture->ID);
|
||||
ShaderProgram.SetInt("tex", 1);
|
||||
ShaderProgram.SetInt("useTexture", 1);
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
ShaderProgram.SetInt("useTexture", 0);
|
||||
}
|
||||
surface.Apply(ShaderProgram, 1, t.GetScale());
|
||||
|
||||
ShaderProgram.SetMat4("modl", topass);
|
||||
ShaderProgram.Set4F("colorOverride", colorOverride);
|
||||
ShaderProgram.Set1F("metallic", metallic);
|
||||
ShaderProgram.Set1F("roughness", roughness);
|
||||
ShaderProgram.Set1F("ao", ao);
|
||||
ShaderProgram.Set1F("emissive", emissive);
|
||||
vao.Bind();
|
||||
glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0);
|
||||
vao.Unbind();
|
||||
|
||||
Reference in New Issue
Block a user