Text archives Help
- From: sparker@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1304 - trunk/Model/Materials
- Date: Wed, 14 Mar 2007 15:10:59 -0700 (MST)
Author: sparker
Date: Wed Mar 14 15:10:58 2007
New Revision: 1304
Modified:
trunk/Model/Materials/AmbientOcclusion.cc
trunk/Model/Materials/Lambertian.cc
trunk/Model/Materials/Phong.cc
trunk/Model/Materials/Transparent.cc
Log:
Update for new shadow algorithm interface
Modified: trunk/Model/Materials/AmbientOcclusion.cc
==============================================================================
--- trunk/Model/Materials/AmbientOcclusion.cc (original)
+++ trunk/Model/Materials/AmbientOcclusion.cc Wed Mar 14 15:10:58 2007
@@ -117,14 +117,11 @@
// Compute the diffuse shading
RayPacketData data;
- ShadowAlgorithm::StateBuffer stateBuffer;
- bool firstTime = true;
- bool done;
+ ShadowAlgorithm::StateBuffer shadowState;
do {
RayPacket shadowRays(data, RayPacket::UnknownShape, 0, 0,
rays.getDepth(), 0);
- done = context.shadowAlgorithm->computeShadows(context, activeLights,
- rays, shadowRays,
- firstTime, stateBuffer);
+ context.shadowAlgorithm->computeShadows(context, shadowState,
activeLights,
+ rays, shadowRays);
shadowRays.normalizeDirections();
for(int j=shadowRays.begin(); j < shadowRays.end(); j++){
if(!shadowRays.wasHit(j)){
@@ -137,9 +134,7 @@
total[k][j] += light[k]*cos_theta*(ColorComponent)0.6;
}
}
-
- firstTime = false;
- } while(!done);
+ } while(!shadowState.done());
// Compute diffuse colors
Packet<Color> diffuse;
Modified: trunk/Model/Materials/Lambertian.cc
==============================================================================
--- trunk/Model/Materials/Lambertian.cc (original)
+++ trunk/Model/Materials/Lambertian.cc Wed Mar 14 15:10:58 2007
@@ -71,22 +71,16 @@
MANTA_ALIGN(16) ColorArray totalLight;
activeLights->getAmbientLight()->computeAmbient(context, rays, totalLight);
- ShadowAlgorithm::StateBuffer stateBuffer;
- bool firstTime = true;
- bool done;
- int count = 0;
+ ShadowAlgorithm::StateBuffer shadowState;
do {
RayPacketData shadowData;
RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0,
rays.getDepth(), 0);
// Call the shadowalgorithm(sa) to generate shadow rays. We may not be
// able to compute all of them, so we pass along a buffer for the sa
- // object to store it's state. The firstTime flag tells the sa to fill
- // in the state rather than using anything in the state buffer. Most
- // sas will only need to store an int or two in the statebuffer.
- done = context.shadowAlgorithm->computeShadows(context, activeLights,
- rays, shadowRays,
- firstTime, stateBuffer);
+ // object to store it's state.
+ context.shadowAlgorithm->computeShadows(context, shadowState,
activeLights,
+ rays, shadowRays);
// We need normalized directions for proper dot product computation.
shadowRays.normalizeDirections();
@@ -186,8 +180,7 @@
}
}
#endif // ifdef MANTA_SSE
- firstTime = false;
- } while(!done);
+ } while(!shadowState.done());
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
Modified: trunk/Model/Materials/Phong.cc
==============================================================================
--- trunk/Model/Materials/Phong.cc (original)
+++ trunk/Model/Materials/Phong.cc Wed Mar 14 15:10:58 2007
@@ -144,10 +144,7 @@
for(int j=0;j<Color::NumComponents;j++)
specularLight[j][i] = 0;
- ShadowAlgorithm::StateBuffer stateBuffer;
- bool firstTime = true;
- bool done;
- int count = 0;
+ ShadowAlgorithm::StateBuffer shadowState;
do {
RayPacketData shadowData;
RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0,
rays.getDepth(), 0);
@@ -157,9 +154,8 @@
// object to store it's state. The firstTime flag tells the sa to fill
// in the state rather than using anything in the state buffer. Most
// sas will only need to store an int or two in the statebuffer.
- done = context.shadowAlgorithm->computeShadows(context, activeLights,
- rays, shadowRays,
- firstTime, stateBuffer);
+ context.shadowAlgorithm->computeShadows(context, shadowState,
activeLights,
+ rays, shadowRays);
// We need normalized directions for proper dot product computation.
shadowRays.normalizeDirections();
@@ -381,8 +377,7 @@
}
}
#endif // ifdef MANTA_SSE
- firstTime = false;
- } while(!done);
+ } while(!shadowState.done());
// Sum up diffuse/specular contributions
#ifdef MANTA_SSE
Modified: trunk/Model/Materials/Transparent.cc
==============================================================================
--- trunk/Model/Materials/Transparent.cc (original)
+++ trunk/Model/Materials/Transparent.cc Wed Mar 14 15:10:58 2007
@@ -82,10 +82,7 @@
// We normalized directions for proper dot product computation.
rays.normalizeDirections();
- ShadowAlgorithm::StateBuffer stateBuffer;
- bool firstTime = true;
- bool done;
- int count = 0;
+ ShadowAlgorithm::StateBuffer shadowState;
do {
RayPacketData shadowData;
RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0,
rays.getDepth(), 0);
@@ -95,9 +92,8 @@
// object to store it's state. The firstTime flag tells the sa to fill
// in the state rather than using anything in the state buffer. Most
// sas will only need to store an int or two in the statebuffer.
- done = context.shadowAlgorithm->computeShadows(context, activeLights,
- rays, shadowRays,
- firstTime, stateBuffer);
+ context.shadowAlgorithm->computeShadows(context, shadowState,
activeLights,
+ rays, shadowRays);
// We need normalized directions for proper dot product computation.
shadowRays.normalizeDirections();
@@ -113,8 +109,7 @@
totalLight[k][j] += light[k]*cos_theta;
}
}
- firstTime = false;
- } while(!done);
+ } while(!shadowState.done());
// Sum up diffuse/specular contributions
for(int i = rays.begin(); i < rays.end(); i++){
- [MANTA] r1304 - trunk/Model/Materials, sparker, 03/14/2007
Archive powered by MHonArc 2.6.16.