History

hacking on transparency

ZappoMan committed 11 years ago

Commit ea31fdc1 parent 4b46fc31 file · +12 −3Browse files

Showing the changes to libraries/render-utils/src/Model.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/Model.cpp+12−3
@@ -791,6 +791,7 @@ namespace render { · 790 unmodified lines
791791 template <> void payloadRender(const TransparentMeshPart::Pointer& payload, RenderArgs* args) {
792792 if (args) {
793793 args->_elementsTouched++;
794+ //qDebug() << "would be TransparentMeshPart: " << payload->meshIndex << "," << payload->partIndex;
794795 return payload->model->renderPart(args, payload->meshIndex, payload->partIndex, true);
795796 }
796797 }
@@ -2189,6 +2190,13 @@ AABox Model::getPartBounds(int meshIndex, int partIndex) { · 1392 unmodified lines
21892190
21902191 void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool translucent) {
21912192 renderSetup(args);
2193+
2194+ /*
2195+ if (translucent) {
2196+ renderCore(args, 1.0f);
2197+ return;
2198+ }
2199+ */
21922200 auto textureCache = DependencyManager::get<TextureCache>();
21932201
21942202 gpu::Batch& batch = *(args->_batch);
@@ -2207,8 +2215,9 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 12 unmodified lines
22072215 batch.setViewTransform(_transforms[0]);
22082216
22092217
2210− const float DEFAULT_ALPHA_THRESHOLD = 0.5f; //
2211− auto alphaThreshold = DEFAULT_ALPHA_THRESHOLD; // FIX ME
2218+ const float OPAQUE_ALPHA_THRESHOLD = 0.5f;
2219+ const float TRANSPARENT_ALPHA_THRESHOLD = 0.0f;
2220+ auto alphaThreshold = translucent ? TRANSPARENT_ALPHA_THRESHOLD : OPAQUE_ALPHA_THRESHOLD; // FIX ME
22122221 const FBXGeometry& geometry = _geometry->getFBXGeometry();
22132222 const QVector<NetworkMesh>& networkMeshes = _geometry->getMeshes();
22142223
@@ -2216,7 +2225,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 1 unmodified line
22162225 const FBXMesh& mesh = geometry.meshes.at(meshIndex);
22172226 const MeshState& state = _meshStates.at(meshIndex);
22182227
2219− bool translucentMesh = networkMesh.getTranslucentPartCount(mesh) == networkMesh.parts.size();
2228+ bool translucentMesh = translucent; // networkMesh.getTranslucentPartCount(mesh) == networkMesh.parts.size();
22202229 bool hasTangents = !mesh.tangents.isEmpty();
22212230 bool hasSpecular = mesh.hasSpecularTexture();
22222231 bool hasLightmap = mesh.hasEmissiveTexture();