mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:57:26 +02:00
debugging the lighting issue on the craps table
This commit is contained in:
parent
dfe17e5708
commit
21f53f1bbd
2 changed files with 14 additions and 10 deletions
|
@ -190,6 +190,7 @@ void Model::RenderPipelineLib::initLocations(gpu::ShaderPointer& program, Model:
|
||||||
locations.emissiveParams = program->getUniforms().findLocation("emissiveParams");
|
locations.emissiveParams = program->getUniforms().findLocation("emissiveParams");
|
||||||
locations.glowIntensity = program->getUniforms().findLocation("glowIntensity");
|
locations.glowIntensity = program->getUniforms().findLocation("glowIntensity");
|
||||||
locations.normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
|
locations.normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
|
||||||
|
locations.normalTextureUnit = program->getTextures().findLocation("normalMap");
|
||||||
locations.specularTextureUnit = program->getTextures().findLocation("specularMap");
|
locations.specularTextureUnit = program->getTextures().findLocation("specularMap");
|
||||||
locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");
|
locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");
|
||||||
locations.materialBufferUnit = program->getBuffers().findLocation("materialBuffer");
|
locations.materialBufferUnit = program->getBuffers().findLocation("materialBuffer");
|
||||||
|
@ -1496,10 +1497,14 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, int shape
|
||||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
const std::vector<std::unique_ptr<NetworkMesh>>& networkMeshes = _geometry->getMeshes();
|
const std::vector<std::unique_ptr<NetworkMesh>>& networkMeshes = _geometry->getMeshes();
|
||||||
|
|
||||||
auto drawMaterial = _geometry->getShapeMaterial(shapeID);
|
auto networkMaterial = _geometry->getShapeMaterial(shapeID);
|
||||||
if (!drawMaterial) {
|
if (!networkMaterial) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
auto material = networkMaterial->_material;
|
||||||
|
if (!material) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Not yet
|
// TODO: Not yet
|
||||||
// auto drawMesh = _geometry->getShapeMesh(shapeID);
|
// auto drawMesh = _geometry->getShapeMesh(shapeID);
|
||||||
|
@ -1516,12 +1521,12 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, int shape
|
||||||
const FBXMesh& mesh = geometry.meshes.at(meshIndex);
|
const FBXMesh& mesh = geometry.meshes.at(meshIndex);
|
||||||
const MeshState& state = _meshStates.at(meshIndex);
|
const MeshState& state = _meshStates.at(meshIndex);
|
||||||
|
|
||||||
auto drawMaterialKey = drawMaterial->_material->getKey();
|
auto drawMaterialKey = material->getKey();
|
||||||
bool translucentMesh = drawMaterialKey.isTransparent() || drawMaterialKey.isTransparentMap();
|
bool translucentMesh = drawMaterialKey.isTransparent() || drawMaterialKey.isTransparentMap();
|
||||||
|
|
||||||
bool hasTangents = !mesh.tangents.isEmpty();
|
bool hasTangents = drawMaterialKey.isNormalMap() && !mesh.tangents.isEmpty();
|
||||||
bool hasSpecular = !drawMaterial->specularTextureName.isEmpty(); //mesh.hasSpecularTexture();
|
bool hasSpecular = drawMaterialKey.isGlossMap(); // !drawMaterial->specularTextureName.isEmpty(); //mesh.hasSpecularTexture();
|
||||||
bool hasLightmap = !drawMaterial->emissiveTextureName.isEmpty(); //mesh.hasEmissiveTexture();
|
bool hasLightmap = drawMaterialKey.isLightmapMap(); // !drawMaterial->emissiveTextureName.isEmpty(); //mesh.hasEmissiveTexture();
|
||||||
bool isSkinned = state.clusterMatrices.size() > 1;
|
bool isSkinned = state.clusterMatrices.size() > 1;
|
||||||
bool wireframe = isWireframe();
|
bool wireframe = isWireframe();
|
||||||
|
|
||||||
|
@ -1624,8 +1629,6 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, int shape
|
||||||
|
|
||||||
const FBXMeshPart& part = mesh.parts.at(partIndex);
|
const FBXMeshPart& part = mesh.parts.at(partIndex);
|
||||||
|
|
||||||
//model::MaterialPointer material = part._material;
|
|
||||||
auto material = drawMaterial->_material;
|
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
if (material == nullptr) {
|
if (material == nullptr) {
|
||||||
|
@ -1633,7 +1636,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, int shape
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (material != nullptr) {
|
{
|
||||||
|
|
||||||
// apply material properties
|
// apply material properties
|
||||||
if (mode != RenderArgs::SHADOW_RENDER_MODE) {
|
if (mode != RenderArgs::SHADOW_RENDER_MODE) {
|
||||||
|
@ -1667,7 +1670,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, int shape
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normal map
|
// Normal map
|
||||||
if (materialKey.isNormalMap()) {
|
if ((locations->normalTextureUnit >= 0) && hasTangents) {
|
||||||
auto normalMap = textureMaps[model::MaterialKey::NORMAL_MAP];
|
auto normalMap = textureMaps[model::MaterialKey::NORMAL_MAP];
|
||||||
if (normalMap && normalMap->isDefined()) {
|
if (normalMap && normalMap->isDefined()) {
|
||||||
batch.setResourceTexture(NORMAL_MAP_SLOT, normalMap->getTextureView());
|
batch.setResourceTexture(NORMAL_MAP_SLOT, normalMap->getTextureView());
|
||||||
|
|
|
@ -339,6 +339,7 @@ private:
|
||||||
int tangent;
|
int tangent;
|
||||||
int alphaThreshold;
|
int alphaThreshold;
|
||||||
int texcoordMatrices;
|
int texcoordMatrices;
|
||||||
|
int normalTextureUnit;
|
||||||
int specularTextureUnit;
|
int specularTextureUnit;
|
||||||
int emissiveTextureUnit;
|
int emissiveTextureUnit;
|
||||||
int emissiveParams;
|
int emissiveParams;
|
||||||
|
|
Loading…
Reference in a new issue