be lenient when texturing objects without texture coordinates

metadata
Wenzel Jakob 2010-10-16 12:29:58 +02:00
parent 781006c968
commit b4f4bf55f7
1 changed files with 7 additions and 1 deletions

View File

@ -252,6 +252,7 @@ void TriMesh::configure() {
for (size_t i=0; i<m_vertexCount; i++) for (size_t i=0; i<m_vertexCount; i++)
m_bsphere.expandBy(m_positions[i]); m_bsphere.expandBy(m_positions[i]);
computeNormals(); computeNormals();
if ((m_bsdf->getType() & BSDF::EAnisotropicMaterial if ((m_bsdf->getType() & BSDF::EAnisotropicMaterial
|| m_bsdf->usesRayDifferentials()) && !m_tangents) || m_bsdf->usesRayDifferentials()) && !m_tangents)
computeTangentSpaceBasis(); computeTangentSpaceBasis();
@ -337,7 +338,7 @@ void TriMesh::computeNormals() {
void TriMesh::computeTangentSpaceBasis() { void TriMesh::computeTangentSpaceBasis() {
int zeroArea = 0, zeroNormals = 0; int zeroArea = 0, zeroNormals = 0;
if (!m_texcoords) if (!m_texcoords && m_bsdf->getType() & BSDF::EAnisotropicMaterial)
Log(EError, "\"%s\": computeTangentSpace(): texture coordinates are required " Log(EError, "\"%s\": computeTangentSpace(): texture coordinates are required "
"to generate tangent vectors. If you want to render with an anisotropic " "to generate tangent vectors. If you want to render with an anisotropic "
"material, make sure that all assigned objects have texture coordinates."); "material, make sure that all assigned objects have texture coordinates.");
@ -359,6 +360,11 @@ void TriMesh::computeTangentSpaceBasis() {
} }
sharers[i] = 0; sharers[i] = 0;
} }
if (!m_texcoords) {
delete [] sharers;
return;
}
for (size_t i=0; i<m_triangleCount; i++) { for (size_t i=0; i<m_triangleCount; i++) {
uint32_t idx0 = m_triangles[i].idx[0], uint32_t idx0 = m_triangles[i].idx[0],