Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e000408593 |
@@ -26,24 +26,13 @@ struct ModelJob : RenderJob
|
|||||||
ModelID = model->ResourceID;
|
ModelID = model->ResourceID;
|
||||||
Type = matProp.type;
|
Type = matProp.type;
|
||||||
::RawModel::MaterialBasic* matGroup = matProp.material;
|
::RawModel::MaterialBasic* matGroup = matProp.material;
|
||||||
|
ShaderID = matProp.ShaderID;
|
||||||
switch(matProp.type){
|
switch(matProp.type){
|
||||||
case ::RawModel::MaterialType::Basic:
|
case ::RawModel::MaterialType::Basic:
|
||||||
if (Model->IsSkinned()) {
|
|
||||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram")->ResourceID;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusProgram")->ResourceID;
|
|
||||||
}
|
|
||||||
TextureID = 0;
|
TextureID = 0;
|
||||||
break;
|
break;
|
||||||
case ::RawModel::MaterialType::SingleTextures:
|
case ::RawModel::MaterialType::SingleTextures:
|
||||||
{
|
{
|
||||||
if (Model->IsSkinned()) {
|
|
||||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram")->ResourceID;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusProgram")->ResourceID;
|
|
||||||
}
|
|
||||||
::RawModel::MaterialSingleTextures* singleTextures = static_cast<::RawModel::MaterialSingleTextures*>(matProp.material);
|
::RawModel::MaterialSingleTextures* singleTextures = static_cast<::RawModel::MaterialSingleTextures*>(matProp.material);
|
||||||
TextureID = (singleTextures->ColorMap.Texture) ? singleTextures->ColorMap.Texture->ResourceID : 0;
|
TextureID = (singleTextures->ColorMap.Texture) ? singleTextures->ColorMap.Texture->ResourceID : 0;
|
||||||
if (modelComponent["DiffuseTexture"]) {
|
if (modelComponent["DiffuseTexture"]) {
|
||||||
@@ -65,12 +54,6 @@ struct ModelJob : RenderJob
|
|||||||
break;
|
break;
|
||||||
case ::RawModel::MaterialType::SplatMapping:
|
case ::RawModel::MaterialType::SplatMapping:
|
||||||
{
|
{
|
||||||
if (Model->IsSkinned()) {
|
|
||||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram")->ResourceID;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram")->ResourceID;
|
|
||||||
}
|
|
||||||
::RawModel::MaterialSplatMapping* SplatTextures = static_cast<::RawModel::MaterialSplatMapping*>(matProp.material);
|
::RawModel::MaterialSplatMapping* SplatTextures = static_cast<::RawModel::MaterialSplatMapping*>(matProp.material);
|
||||||
|
|
||||||
SplatMap = &SplatTextures->SplatMap;
|
SplatMap = &SplatTextures->SplatMap;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "../Core/ResourceManager.h"
|
#include "../Core/ResourceManager.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "Skeleton.h"
|
#include "Skeleton.h"
|
||||||
|
#include "ShaderProgram.h"
|
||||||
|
|
||||||
#include "boost\endian\buffers.hpp"
|
#include "boost\endian\buffers.hpp"
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ public:
|
|||||||
struct MaterialProperties {
|
struct MaterialProperties {
|
||||||
MaterialType type;
|
MaterialType type;
|
||||||
MaterialBasic* material;
|
MaterialBasic* material;
|
||||||
|
unsigned int ShaderID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Vertex* Vertices() const {
|
const Vertex* Vertices() const {
|
||||||
|
|||||||
@@ -148,14 +148,29 @@ void RawModelCustom::ReadMaterialSingle(std::size_t& offset, char* fileData, con
|
|||||||
case MaterialType::Basic:
|
case MaterialType::Basic:
|
||||||
newMaterialProperty.material = new MaterialBasic();
|
newMaterialProperty.material = new MaterialBasic();
|
||||||
ReadMaterialBasic(newMaterialProperty.material, offset, fileData, fileByteSize);
|
ReadMaterialBasic(newMaterialProperty.material, offset, fileData, fileByteSize);
|
||||||
|
if(hasSkin){
|
||||||
|
newMaterialProperty.ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram")->ResourceID;
|
||||||
|
} else {
|
||||||
|
newMaterialProperty.ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusProgram")->ResourceID;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MaterialType::SplatMapping:
|
case MaterialType::SplatMapping:
|
||||||
newMaterialProperty.material = new MaterialSplatMapping();
|
newMaterialProperty.material = new MaterialSplatMapping();
|
||||||
ReadMaterialSplatMapping(static_cast<MaterialSplatMapping*>(newMaterialProperty.material), offset, fileData, fileByteSize);
|
ReadMaterialSplatMapping(static_cast<MaterialSplatMapping*>(newMaterialProperty.material), offset, fileData, fileByteSize);
|
||||||
|
if (hasSkin){
|
||||||
|
newMaterialProperty.ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram")->ResourceID;
|
||||||
|
} else {
|
||||||
|
newMaterialProperty.ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram")->ResourceID;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MaterialType::SingleTextures:
|
case MaterialType::SingleTextures:
|
||||||
newMaterialProperty.material = new MaterialSingleTextures();
|
newMaterialProperty.material = new MaterialSingleTextures();
|
||||||
ReadMaterialSingleTexture(static_cast<MaterialSingleTextures*>(newMaterialProperty.material), offset, fileData, fileByteSize);
|
ReadMaterialSingleTexture(static_cast<MaterialSingleTextures*>(newMaterialProperty.material), offset, fileData, fileByteSize);
|
||||||
|
if (hasSkin){
|
||||||
|
newMaterialProperty.ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram")->ResourceID;
|
||||||
|
} else {
|
||||||
|
newMaterialProperty.ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusProgram")->ResourceID;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Resource::FailedLoadingException("Material contains an unknown MaterialType");
|
throw Resource::FailedLoadingException("Material contains an unknown MaterialType");
|
||||||
|
|||||||
Reference in New Issue
Block a user