mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:17:40 +02:00
Merge pull request #4218 from samcake/temp0
Fix the lightmap not displaying when using the texcoord0
This commit is contained in:
commit
1e00d2199a
3 changed files with 13 additions and 3 deletions
|
@ -1304,6 +1304,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
||||||
QString jointLeftToeID;
|
QString jointLeftToeID;
|
||||||
QString jointRightToeID;
|
QString jointRightToeID;
|
||||||
|
|
||||||
|
float lightmapOffset = 0.0f;
|
||||||
|
|
||||||
QVector<QString> humanIKJointNames;
|
QVector<QString> humanIKJointNames;
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
QByteArray jointName = HUMANIK_JOINTS[i];
|
QByteArray jointName = HUMANIK_JOINTS[i];
|
||||||
|
@ -2123,6 +2125,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
||||||
|
|
||||||
FBXTexture emissiveTexture;
|
FBXTexture emissiveTexture;
|
||||||
glm::vec2 emissiveParams(0.f, 1.f);
|
glm::vec2 emissiveParams(0.f, 1.f);
|
||||||
|
emissiveParams.x = lightmapOffset;
|
||||||
emissiveParams.y = lightmapLevel;
|
emissiveParams.y = lightmapLevel;
|
||||||
QString emissiveTextureID = emissiveTextures.value(childID);
|
QString emissiveTextureID = emissiveTextures.value(childID);
|
||||||
QString ambientTextureID = ambientTextures.value(childID);
|
QString ambientTextureID = ambientTextures.value(childID);
|
||||||
|
|
|
@ -49,7 +49,7 @@ static const GLenum _elementTypeToGLType[NUM_TYPES]= {
|
||||||
GL_UNSIGNED_BYTE
|
GL_UNSIGNED_BYTE
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError()
|
//#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError()
|
||||||
//#define CHECK_GL_ERROR()
|
#define CHECK_GL_ERROR()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2120,6 +2120,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
||||||
NetworkMesh networkMesh;
|
NetworkMesh networkMesh;
|
||||||
|
|
||||||
int totalIndices = 0;
|
int totalIndices = 0;
|
||||||
|
bool checkForTexcoordLightmap = false;
|
||||||
foreach (const FBXMeshPart& part, mesh.parts) {
|
foreach (const FBXMeshPart& part, mesh.parts) {
|
||||||
NetworkMeshPart networkPart;
|
NetworkMeshPart networkPart;
|
||||||
if (!part.diffuseTexture.filename.isEmpty()) {
|
if (!part.diffuseTexture.filename.isEmpty()) {
|
||||||
|
@ -2149,6 +2150,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
||||||
false, part.emissiveTexture.content);
|
false, part.emissiveTexture.content);
|
||||||
networkPart.emissiveTextureName = part.emissiveTexture.name;
|
networkPart.emissiveTextureName = part.emissiveTexture.name;
|
||||||
networkPart.emissiveTexture->setLoadPriorities(_loadPriorities);
|
networkPart.emissiveTexture->setLoadPriorities(_loadPriorities);
|
||||||
|
checkForTexcoordLightmap = true;
|
||||||
}
|
}
|
||||||
networkMesh.parts.append(networkPart);
|
networkMesh.parts.append(networkPart);
|
||||||
|
|
||||||
|
@ -2215,7 +2217,12 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
||||||
if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||||
if (mesh.colors.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::COLOR, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RGB));
|
if (mesh.colors.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::COLOR, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RGB));
|
||||||
if (mesh.texCoords.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TEXCOORD, channelNum++, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
|
if (mesh.texCoords.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TEXCOORD, channelNum++, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
|
||||||
if (mesh.texCoords1.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, channelNum++, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
|
if (mesh.texCoords1.size()) {
|
||||||
|
networkMesh._vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, channelNum++, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
|
||||||
|
} else if (checkForTexcoordLightmap && mesh.texCoords.size()) {
|
||||||
|
// need lightmap texcoord UV but doesn't have uv#1 so just reuse the same channel
|
||||||
|
networkMesh._vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, channelNum - 1, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
|
||||||
|
}
|
||||||
if (mesh.clusterIndices.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::SKIN_CLUSTER_INDEX, channelNum++, gpu::Element(gpu::VEC4, gpu::NFLOAT, gpu::XYZW));
|
if (mesh.clusterIndices.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::SKIN_CLUSTER_INDEX, channelNum++, gpu::Element(gpu::VEC4, gpu::NFLOAT, gpu::XYZW));
|
||||||
if (mesh.clusterWeights.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::SKIN_CLUSTER_WEIGHT, channelNum++, gpu::Element(gpu::VEC4, gpu::NFLOAT, gpu::XYZW));
|
if (mesh.clusterWeights.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::SKIN_CLUSTER_WEIGHT, channelNum++, gpu::Element(gpu::VEC4, gpu::NFLOAT, gpu::XYZW));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue