Text archives Help
- From: "Austin Robison" <arobison@rayscale.com>
- To: manta@sci.utah.edu
- Subject: [Manta] r2052 - trunk/Model/Primitives
- Date: Tue, 12 Feb 2008 02:25:30 -0700 (MST)
Author: arobison
Date: Tue Feb 12 02:25:29 2008
New Revision: 2052
Modified:
trunk/Model/Primitives/KenslerShirleyTriangle.cc
Log:
Making sure there actually are UVs before trying to create
a parameterization based on them, plus swizzling the barycentric
coordinates passed to the new spline method from KenslerShirley
triangles to match the computed coordinates; surface derivatives
are nearly smooth, one bug remaining it would seem.
Modified: trunk/Model/Primitives/KenslerShirleyTriangle.cc
==============================================================================
--- trunk/Model/Primitives/KenslerShirleyTriangle.cc (original)
+++ trunk/Model/Primitives/KenslerShirleyTriangle.cc Tue Feb 12 02:25:29
2008
@@ -48,12 +48,23 @@
void KenslerShirleyTriangle::computeSurfaceDerivatives(const RenderContext&
context, RayPacket& rays) const
{
+ const int which = myID*3;
+ const unsigned int uv0_idx = mesh->texture_indices.size() ?
+ mesh->texture_indices[which] : Mesh::kNoTextureIndex;
+
+ // No texture coords means use the default implementation
+ if (uv0_idx == Mesh::kNoTextureIndex) {
+ Primitive::computeSurfaceDerivatives(context, rays);
+ return;
+ }
+
for(int i = rays.begin(); i != rays.end(); ++i) {
+
float a = rays.getScratchpad<float>(SCRATCH_U)[i];
float b = rays.getScratchpad<float>(SCRATCH_V)[i];
Vector dPdu, dPdv;
- computeSplineSurfaceDerivatives(a,b, dPdu,dPdv);
+ computeSplineSurfaceDerivatives((1-a-b),a, dPdu,dPdv);
rays.setSurfaceDerivativeU(i, dPdu);
rays.setSurfaceDerivativeV(i, dPdv);
- [Manta] r2052 - trunk/Model/Primitives, Austin Robison, 02/12/2008
Archive powered by MHonArc 2.6.16.