This commit is contained in:
2025-11-15 16:27:19 +08:00
parent 8db6f7b115
commit a0beb9eac7
35 changed files with 886 additions and 128 deletions
+18 -16
View File
@@ -3,6 +3,7 @@
#include "dvc_config.h"
#include "dvc_pre_declare.h"
#include "math/dvc_vector4.h"
#include "math/dvc_matrix3.h"
DV_CORE_BEGIN_NAMESPACE
@@ -13,16 +14,14 @@ public:
{
TextureConstPtr texture;
int32_t texCoord = 0;
fMatrix3 uvTransform;
};
public:
int32_t getID(void) const { return m_id; }
void setBaseColorTexture(const TextureConstPtr& texture, int32_t texCoord, const fVector4& baseColorfactor) {
m_baseColorTexture.texture = texture;
m_baseColorTexture.texCoord = texCoord;
m_baseColorFactor = baseColorfactor;
}
void setBaseColorTexture(const TextureConstPtr& texture, int32_t texCoord, const fMatrix3& uvTransform,
const fVector4& baseColorfactor);
const TextureInfo& getBaseColorTexture() const {
return m_baseColorTexture;
}
@@ -31,12 +30,8 @@ public:
return m_baseColorFactor;
}
void setMetallicRoughnessTexture(const TextureConstPtr& texture, int32_t texCoord, float32_t metallicFactor=1.f, float32_t roughnessFactor=1.f ) {
m_metallicRoughnessTexture.texture = texture;
m_metallicRoughnessTexture.texCoord = texCoord;
m_metallicFactor = metallicFactor;
m_roughnessFactor = roughnessFactor;
}
void setMetallicRoughnessTexture(const TextureConstPtr& texture, int32_t texCoord, const fMatrix3& uvTransform,
float32_t metallicFactor = 1, float32_t roughnessFactor = 1);
const TextureInfo& getMetallicRoughnessTexture() const {
return m_metallicRoughnessTexture;
@@ -50,11 +45,8 @@ public:
return m_roughnessFactor;
}
void setNormalTexture(const TextureConstPtr& texture, int32_t texCoord, float32_t scale=1.f) {
m_normalTexture.texture = texture;
m_normalTexture.texCoord = texCoord;
m_normalScale = scale;
}
void setNormalTexture(const TextureConstPtr& texture, int32_t texCoord, const fMatrix3& uvTransform,
float32_t scale = 1);
const TextureInfo& getNormalTexture() const {
return m_normalTexture;
@@ -64,6 +56,9 @@ public:
return m_normalScale;
}
void setVertexShader(const char* szShaderFile, const char* vertexShaderName);
void setFragementShader(const char* szShaderFile, const char* fragementShaderName);
VertexShaderInterface* getVertexShader() const {
return m_vertexShader;
}
@@ -72,6 +67,7 @@ public:
return m_pixelShader;
}
public:
bool loadShader();
@@ -105,6 +101,12 @@ protected:
VertexShaderInterface* m_vertexShader = nullptr;
PixelShaderInterface* m_pixelShader = nullptr;
std::string m_vertexshaderFile;
std::string m_vertexShaderName;
std::string m_fragementShaderFile;
std::string m_fragementShaderName;
public:
Material(int32_t id);
~Material();
+1
View File
@@ -4,6 +4,7 @@
#include "dvc_pre_declare.h"
#include "math/dvc_vector2.h"
#include "math/dvc_vector4.h"
#include "math/dvc_matrix3.h"
DV_CORE_BEGIN_NAMESPACE