Text archives Help
- From: boulos@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1599 - in trunk: Engine/Shadows Model/AmbientLights Model/Backgrounds Model/Cameras Model/Groups Model/Lights Model/Materials Model/Primitives Model/TexCoordMappers Model/Textures
- Date: Wed, 1 Aug 2007 19:27:51 -0600 (MDT)
Author: boulos
Date: Wed Aug 1 19:27:49 2007
New Revision: 1599
Modified:
trunk/Engine/Shadows/HardShadows.cc
trunk/Model/AmbientLights/ConstantAmbient.cc
trunk/Model/Backgrounds/ConstantBackground.cc
trunk/Model/Cameras/PinholeCamera.cc
trunk/Model/Groups/DynBVH.cc
trunk/Model/Lights/AreaLight.cc
trunk/Model/Lights/PointLight.cc
trunk/Model/Materials/CopyTextureMaterial.cc
trunk/Model/Materials/Flat.cc
trunk/Model/Materials/Lambertian.cc
trunk/Model/Materials/OpaqueShadower.cc
trunk/Model/Materials/Phong.cc
trunk/Model/Primitives/Parallelogram.cc
trunk/Model/Primitives/Sphere.cc
trunk/Model/TexCoordMappers/UniformMapper.cc
trunk/Model/Textures/CheckerTexture.cc
trunk/Model/Textures/Constant.cc
trunk/Model/Textures/TileTexture.cc
Log:
Engine/Shadows/HardShadows.cc
Model/AmbientLights/ConstantAmbient.cc
Model/Backgrounds/ConstantBackground.cc
Model/Cameras/PinholeCamera.cc
Model/Groups/DynBVH.cc
Model/Lights/AreaLight.cc
Model/Lights/PointLight.cc
Model/Materials/CopyTextureMaterial.cc
Model/Materials/Flat.cc
Model/Materials/Lambertian.cc
Model/Materials/OpaqueShadower.cc
Model/Materials/Phong.cc
Model/Primitives/Parallelogram.cc
Model/Primitives/Sphere.cc
Model/TexCoordMappers/UniformMapper.cc
Model/Textures/CheckerTexture.cc
Model/Textures/Constant.cc
Model/Textures/TileTexture.cc
Updating all "short ray" cases to check for b >= e. In the case of
rayBegin = 22, rayEnd = 23, then b = 24 and e = 20 (so b can be >= e
not just equal).
Engine/Shadows/HardShadows.cc
Making the SSE path also set the minT to be -MAX_T like the scalar paths
and
ensuring that the origins are always set anyway.
Modified: trunk/Engine/Shadows/HardShadows.cc
==============================================================================
--- trunk/Engine/Shadows/HardShadows.cc (original)
+++ trunk/Engine/Shadows/HardShadows.cc Wed Aug 1 19:27:49 2007
@@ -80,7 +80,8 @@
#ifdef MANTA_SSE
int b = (sourceRays.rayBegin + 3) & (~3);
int e = sourceRays.rayEnd & (~3);
- if(b == e){
+ // NOTE(boulos): b can be > e for small packets
+ if(b >= e){
for(int i = sourceRays.begin(); i < sourceRays.end(); i++){
Vector dir = shadowRays.getDirection(i);
if(Dot(dir, sourceRays.getFFNormal(i)) > 0) {
@@ -112,6 +113,7 @@
shadowRays.maskRay(i);
}
}
+
RayPacketData* sourceData = sourceRays.data;
RayPacketData* shadowData = shadowRays.data;
for(;i<e;i+=4){
@@ -130,27 +132,23 @@
#else
_mm_store_ps((float*)&shadowData->hitMatl[i], mask);
#endif
- if(_mm_movemask_ps(mask) != 0xf){
- // Mask is inverted to make our life easier. 1 means do not
compute shadow ray
- _mm_store_ps(&shadowData->origin[0][i],
_mm_load_ps(&sourceData->hitPosition[0][i]));
- _mm_store_ps(&shadowData->origin[1][i],
_mm_load_ps(&sourceData->hitPosition[1][i]));
- _mm_store_ps(&shadowData->origin[2][i],
_mm_load_ps(&sourceData->hitPosition[2][i]));
-
- // The materials have already been set by the code above.
- // Don't touch minT.
- // TODO(boulos): I think this is probably required to actually
reset the hitMatl properly
-#ifdef __x86_64
- _mm_store_ps((float*)&shadowData->hitMatl[i], _mm_setzero_ps());
- _mm_store_ps((float*)&shadowData->hitMatl[i+2], _mm_setzero_ps());
-#else
- _mm_store_ps((float*)&shadowData->hitMatl[i], _mm_setzero_ps());
-#endif
+ _mm_store_ps((float*)&shadowData->minT[i],
+ _mm_or_ps(_mm_andnot_ps(mask,
+
_mm_load_ps((float*)&shadowData->minT[i])),
+ _mm_and_ps(mask, _mm_set1_ps(-MAXT))));
+
+ _mm_store_ps(&shadowData->origin[0][i],
_mm_load_ps(&sourceData->hitPosition[0][i]));
+ _mm_store_ps(&shadowData->origin[1][i],
_mm_load_ps(&sourceData->hitPosition[1][i]));
+ _mm_store_ps(&shadowData->origin[2][i],
_mm_load_ps(&sourceData->hitPosition[2][i]));
+
+ if(_mm_movemask_ps(mask) != 0xf){
last = i+3;
if (first < 0)
first = i;
}
}
+
for(;i<sourceRays.rayEnd;i++){
Vector dir = shadowRays.getDirection(i);
if(Dot(dir, sourceRays.getFFNormal(i)) > 0) {
@@ -165,6 +163,7 @@
}
}
}
+
#else // ifdef MANTA_SSE
for(int i = sourceRays.begin(); i < sourceRays.end(); i++){
// Check to see if the light is on the front face.
Modified: trunk/Model/AmbientLights/ConstantAmbient.cc
==============================================================================
--- trunk/Model/AmbientLights/ConstantAmbient.cc (original)
+++ trunk/Model/AmbientLights/ConstantAmbient.cc Wed Aug 1 19:27:49
2007
@@ -30,7 +30,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
for(int j=0;j<Color::NumComponents;j++)
ambient[j][i] = color[j];
Modified: trunk/Model/Backgrounds/ConstantBackground.cc
==============================================================================
--- trunk/Model/Backgrounds/ConstantBackground.cc (original)
+++ trunk/Model/Backgrounds/ConstantBackground.cc Wed Aug 1 19:27:49
2007
@@ -23,7 +23,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
rays.setColor(i, bgcolor);
}
Modified: trunk/Model/Cameras/PinholeCamera.cc
==============================================================================
--- trunk/Model/Cameras/PinholeCamera.cc (original)
+++ trunk/Model/Cameras/PinholeCamera.cc Wed Aug 1 19:27:49 2007
@@ -152,7 +152,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Vector raydir(v*rays.getImageCoordinates(i,
0)+u*rays.getImageCoordinates(i, 1)+direction);
raydir.normalize();
Modified: trunk/Model/Groups/DynBVH.cc
==============================================================================
--- trunk/Model/Groups/DynBVH.cc (original)
+++ trunk/Model/Groups/DynBVH.cc Wed Aug 1 19:27:49 2007
@@ -171,7 +171,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if (b==e) {
+ if (b >=e) {
for (int i = rays.begin(); i < rays.end(); i++) {
float tmin = 1e-5f;
float tmax = rays.getMinT(i);
Modified: trunk/Model/Lights/AreaLight.cc
==============================================================================
--- trunk/Model/Lights/AreaLight.cc (original)
+++ trunk/Model/Lights/AreaLight.cc Wed Aug 1 19:27:49 2007
@@ -26,7 +26,7 @@
#ifdef MANTA_SSE
int b = (sourceRays.rayBegin + 3) & (~3);
int e = sourceRays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = sourceRays.begin(); i < sourceRays.end(); i++){
// Generate a point on the light
Vector dir = positions.get(i) - sourceRays.getHitPosition(i);
Modified: trunk/Model/Lights/PointLight.cc
==============================================================================
--- trunk/Model/Lights/PointLight.cc (original)
+++ trunk/Model/Lights/PointLight.cc Wed Aug 1 19:27:49 2007
@@ -24,7 +24,7 @@
#ifdef MANTA_SSE
int b = (sourceRays.rayBegin + 3) & (~3);
int e = sourceRays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = sourceRays.begin(); i < sourceRays.end(); i++){
destRays.setColor(i, color);
destRays.setDirection(i, position - sourceRays.getHitPosition(i));
Modified: trunk/Model/Materials/CopyTextureMaterial.cc
==============================================================================
--- trunk/Model/Materials/CopyTextureMaterial.cc (original)
+++ trunk/Model/Materials/CopyTextureMaterial.cc Wed Aug 1 19:27:49
2007
@@ -32,7 +32,7 @@
#else
int b = (rays.rayBegin + 3) & ~3;
int e = (rays.rayEnd) & ~3;
- if (b == e) {
+ if (b >= e) {
for (int i = rays.begin(); i < rays.end(); i++) {
rays.setColor( i, colors.get(i) );
}
Modified: trunk/Model/Materials/Flat.cc
==============================================================================
--- trunk/Model/Materials/Flat.cc (original)
+++ trunk/Model/Materials/Flat.cc Wed Aug 1 19:27:49 2007
@@ -72,7 +72,7 @@
#else
int b = (rays.rayBegin + 3) & ~3;
int e = (rays.rayEnd) & ~3;
- if (b == e) {
+ if (b >= e) {
for (int i = rays.begin(); i < rays.end(); i++) {
ColorComponent cosine = fabs(Dot(rays.getFFNormal(i),
rays.getDirection(i)));
rays.setColor(i, colors.get(i) * cosine);
Modified: trunk/Model/Materials/Lambertian.cc
==============================================================================
--- trunk/Model/Materials/Lambertian.cc (original)
+++ trunk/Model/Materials/Lambertian.cc Wed Aug 1 19:27:49 2007
@@ -78,7 +78,7 @@
activeLights->getAmbientLight()->computeAmbient(context, rays, totalLight);
ShadowAlgorithm::StateBuffer shadowState;
- do {
+ do {
RayPacketData shadowData;
RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0,
rays.getDepth(), debugFlag);
@@ -94,7 +94,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
if(!shadowRays.wasHit(i)){
// Not in shadow, so compute the direct lighting contributions.
@@ -191,7 +191,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Color result;
for(int j=0;j<Color::NumComponents;j++)
Modified: trunk/Model/Materials/OpaqueShadower.cc
==============================================================================
--- trunk/Model/Materials/OpaqueShadower.cc (original)
+++ trunk/Model/Materials/OpaqueShadower.cc Wed Aug 1 19:27:49 2007
@@ -41,7 +41,7 @@
#ifdef MANTA_SSE
int b = (shadowRays.rayBegin + 3) & (~3);
int e = shadowRays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = shadowRays.begin(); i < shadowRays.end(); i++){
shadowRays.setColor(i, Color::black());
}
Modified: trunk/Model/Materials/Phong.cc
==============================================================================
--- trunk/Model/Materials/Phong.cc (original)
+++ trunk/Model/Materials/Phong.cc Wed Aug 1 19:27:49 2007
@@ -122,7 +122,7 @@
}
// Shade a bunch of rays. We know that they all have the same intersected
// object and are all of the same material
-
+
// We need normalized directions for proper dot product computation.
rays.normalizeDirections();
@@ -164,7 +164,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
if(!shadowRays.wasHit(i)){
// Not in shadow, so compute the direct and specular contributions.
@@ -217,7 +217,7 @@
// We are interested in the rays that didn't hit anything
__m128 mask = shadowRays.wereNotHitSSE(i);
-
+
if(_mm_movemask_ps(mask) == 0)
// All hit points are in shadow
continue;
@@ -275,7 +275,7 @@
_mm_maskmoveu_si128((__m128i)
_mm_castps_si128(_mm_add_ps(_mm_load_ps(&ambientAndDiffuseLight[2][i]),
_mm_mul_ps(lightb, cos_theta))), (__m128i) _mm_castps_si128(mask),
(char*)&ambientAndDiffuseLight[2][i]);
#endif
}
-
+
__m128 Hx = _mm_sub_ps(sdx, _mm_load_ps(&data->direction[0][i]));
__m128 Hy = _mm_sub_ps(sdy, _mm_load_ps(&data->direction[1][i]));
__m128 Hz = _mm_sub_ps(sdz, _mm_load_ps(&data->direction[2][i]));
@@ -384,7 +384,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Color result;
for(int j=0;j<Color::NumComponents;j++)
@@ -435,7 +435,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Vector refl_dir = (rays.getDirection(i) -
rays.getFFNormal(i)*(2*Dot(rays.getFFNormal(i),
rays.getDirection(i) )));
@@ -509,7 +509,7 @@
}
}
#ifdef MANTA_SSE
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
rays.setColor(i, rays.getColor(i) + refl_rays.getColor(i) *
refl.data[i]);
}
@@ -521,7 +521,7 @@
RayPacketData* data = rays.data;
RayPacketData* refldata = refl_rays.data;
for(;i<e;i+=4){
- __m128 r = _mm_load_ps(&refl.data[i]);
+ __m128 r = _mm_load_ps(&refl.data[i]);
_mm_store_ps(&data->color[0][i],
_mm_add_ps(_mm_load_ps(&data->color[0][i]),
_mm_mul_ps(_mm_load_ps(&refldata->color[0][i]), r)));
_mm_store_ps(&data->color[1][i],
_mm_add_ps(_mm_load_ps(&data->color[1][i]),
_mm_mul_ps(_mm_load_ps(&refldata->color[1][i]), r)));
_mm_store_ps(&data->color[2][i],
_mm_add_ps(_mm_load_ps(&data->color[2][i]),
_mm_mul_ps(_mm_load_ps(&refldata->color[2][i]), r)));
Modified: trunk/Model/Primitives/Parallelogram.cc
==============================================================================
--- trunk/Model/Primitives/Parallelogram.cc (original)
+++ trunk/Model/Primitives/Parallelogram.cc Wed Aug 1 19:27:49 2007
@@ -83,7 +83,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Real dt=Dot(rays.getDirection(i), normal);
if(Abs(dt) < (Real)1.e-6)
@@ -299,7 +299,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i=rays.rayBegin;i<rays.rayEnd;i++){
Vector dir = rays.getDirection(i);
Real dt=Dot(dir, normal);
Modified: trunk/Model/Primitives/Sphere.cc
==============================================================================
--- trunk/Model/Primitives/Sphere.cc (original)
+++ trunk/Model/Primitives/Sphere.cc Wed Aug 1 19:27:49 2007
@@ -83,7 +83,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Vector D(rays.getDirection(i));
Real B = Dot(O, D);
@@ -208,7 +208,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Vector O(rays.getOrigin(i)-center);
Vector D(rays.getDirection(i));
Modified: trunk/Model/TexCoordMappers/UniformMapper.cc
==============================================================================
--- trunk/Model/TexCoordMappers/UniformMapper.cc (original)
+++ trunk/Model/TexCoordMappers/UniformMapper.cc Wed Aug 1 19:27:49
2007
@@ -13,13 +13,13 @@
}
void UniformMapper::computeTexCoords2(const RenderContext&,
- RayPacket& rays) const
+ RayPacket& rays) const
{
rays.computeHitPositions();
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
rays.setTexCoords(i, rays.getHitPosition(i));
}
@@ -47,13 +47,13 @@
}
void UniformMapper::computeTexCoords3(const RenderContext&,
- RayPacket& rays) const
+ RayPacket& rays) const
{
rays.computeHitPositions();
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
rays.setTexCoords(i, rays.getHitPosition(i));
}
Modified: trunk/Model/Textures/CheckerTexture.cc
==============================================================================
--- trunk/Model/Textures/CheckerTexture.cc (original)
+++ trunk/Model/Textures/CheckerTexture.cc Wed Aug 1 19:27:49 2007
@@ -3,7 +3,7 @@
#ifdef MANTA_SSE
namespace Manta {
-
+
template<>
void CheckerTexture<Color>::mapValues(Packet<Color>& results,
const RenderContext& context,
@@ -16,7 +16,7 @@
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
@@ -94,7 +94,7 @@
rays.computeTextureCoordinates2(context);
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
Modified: trunk/Model/Textures/Constant.cc
==============================================================================
--- trunk/Model/Textures/Constant.cc (original)
+++ trunk/Model/Textures/Constant.cc Wed Aug 1 19:27:49 2007
@@ -12,7 +12,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
results.set(i, value);
}
@@ -45,7 +45,7 @@
#ifdef MANTA_SSE
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
results.set(i, value);
}
Modified: trunk/Model/Textures/TileTexture.cc
==============================================================================
--- trunk/Model/Textures/TileTexture.cc (original)
+++ trunk/Model/Textures/TileTexture.cc Wed Aug 1 19:27:49 2007
@@ -2,12 +2,12 @@
/*
* TileTexture.cc
*/
-
+
#include <Model/Textures/TileTexture.h>
#ifdef MANTA_SSE
namespace Manta {
-
+
template<>
void TileTexture<Color>::mapValues(Packet<Color>& results, const
RenderContext& context, RayPacket& rays) const
{
@@ -18,38 +18,38 @@
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
- Real vv1_=vv1;
+ Real vv1_=vv1;
Real vv2_=vv2;
- int i1;
- int i2;
+ int i1;
+ int i2;
if(vv1>0){
i1 =(int)vv1;
- }
- else
- {
- int i11=-(int)(-vv1);
- if(i11==vv1)
- i1=i11;
- else
- i1=i11-1;
- }
- if(vv2>0){
+ }
+ else
+ {
+ int i11=-(int)(-vv1);
+ if(i11==vv1)
+ i1=i11;
+ else
+ i1=i11-1;
+ }
+ if(vv2>0){
i2 =(int)vv2;
- }
- else
- {
- int i22=-(int)(-vv2);
- if(i22==vv2)
- i2=i22;
- else
- i2=i22-1;
- }
- Real ii1=vv1_-i1;
- Real ii2=vv2_-i2;
+ }
+ else
+ {
+ int i22=-(int)(-vv2);
+ if(i22==vv2)
+ i2=i22;
+ else
+ i2=i22-1;
+ }
+ Real ii1=vv1_-i1;
+ Real ii2=vv2_-i2;
int which = ((ii1<tile_gap)||(ii2<tile_gap));
results.set(i, values[which]);
}
@@ -58,34 +58,34 @@
for(;i<b;i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
- Real vv1_=vv1;
+ Real vv1_=vv1;
Real vv2_=vv2;
int i1;
- int i2;
+ int i2;
if(vv1>0){
i1 =(int)vv1;
- }
- else
- {
- int i11=-(int)(-vv1);
- if(i11==vv1)
- i1=i11;
- else
- i1=i11-1;
- }
- if(vv2>0){
+ }
+ else
+ {
+ int i11=-(int)(-vv1);
+ if(i11==vv1)
+ i1=i11;
+ else
+ i1=i11-1;
+ }
+ if(vv2>0){
i2 =(int)vv2;
- }
- else
- {
- int i22=-(int)(-vv2);
- if(i22==vv2)
- i2=i22;
- else
- i2=i22-1;
- }
- Real ii1=vv1_-i1;
- Real ii2=vv2_-i2;
+ }
+ else
+ {
+ int i22=-(int)(-vv2);
+ if(i22==vv2)
+ i2=i22;
+ else
+ i2=i22-1;
+ }
+ Real ii1=vv1_-i1;
+ Real ii2=vv2_-i2;
int which = ((ii1<tile_gap)||(ii2<tile_gap));
results.set(i, values[which]);
}
@@ -117,34 +117,34 @@
for(;i<rays.rayEnd;i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
- Real vv1_=vv1;
+ Real vv1_=vv1;
Real vv2_=vv2;
- int i1;
- int i2;
+ int i1;
+ int i2;
if(vv1>0){
i1 =(int)vv1;
- }
- else
- {
- int i11=-(int)(-vv1);
- if(i11==vv1)
- i1=i11;
- else
- i1=i11-1;
- }
- if(vv2>0){
+ }
+ else
+ {
+ int i11=-(int)(-vv1);
+ if(i11==vv1)
+ i1=i11;
+ else
+ i1=i11-1;
+ }
+ if(vv2>0){
i2 =(int)vv2;
- }
- else
- {
- int i22=-(int)(-vv2);
- if(i22==vv2)
- i2=i22;
- else
- i2=i22-1;
- }
- Real ii1=vv1_-i1;
- Real ii2=vv2_-i2;
+ }
+ else
+ {
+ int i22=-(int)(-vv2);
+ if(i22==vv2)
+ i2=i22;
+ else
+ i2=i22-1;
+ }
+ Real ii1=vv1_-i1;
+ Real ii2=vv2_-i2;
int which = ((ii1<tile_gap)||(ii2<tile_gap));
results.set(i, values[which]);
}
@@ -160,38 +160,38 @@
rays.computeTextureCoordinates2(context);
int b = (rays.rayBegin + 3) & (~3);
int e = rays.rayEnd & (~3);
- if(b == e){
+ if(b >= e){
for(int i = rays.begin(); i < rays.end(); i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
- Real vv1_=vv1;
+ Real vv1_=vv1;
Real vv2_=vv2;
- int i1;
- int i2;
+ int i1;
+ int i2;
if(vv1>0){
i1 =(int)vv1;
- }
- else
- {
- int i11=-(int)(-vv1);
- if(i11==vv1)
- i1=i11;
- else
- i1=i11-1;
- }
- if(vv2>0){
+ }
+ else
+ {
+ int i11=-(int)(-vv1);
+ if(i11==vv1)
+ i1=i11;
+ else
+ i1=i11-1;
+ }
+ if(vv2>0){
i2 =(int)vv2;
- }
- else
- {
- int i22=-(int)(-vv2);
- if(i22==vv2)
- i2=i22;
- else
- i2=i22-1;
- }
- Real ii1=vv1_-i1;
- Real ii2=vv2_-i2;
+ }
+ else
+ {
+ int i22=-(int)(-vv2);
+ if(i22==vv2)
+ i2=i22;
+ else
+ i2=i22-1;
+ }
+ Real ii1=vv1_-i1;
+ Real ii2=vv2_-i2;
int which = ((ii1<tile_gap)||(ii2<tile_gap));
results.set(i, values[which]);
}
@@ -200,34 +200,34 @@
for(;i<b;i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
- Real vv1_=vv1;
+ Real vv1_=vv1;
Real vv2_=vv2;
- int i1;
- int i2;
+ int i1;
+ int i2;
if(vv1>0){
i1 =(int)vv1;
- }
- else
- {
- int i11=-(int)(-vv1);
- if(i11==vv1)
- i1=i11;
- else
- i1=i11-1;
- }
- if(vv2>0){
+ }
+ else
+ {
+ int i11=-(int)(-vv1);
+ if(i11==vv1)
+ i1=i11;
+ else
+ i1=i11-1;
+ }
+ if(vv2>0){
i2 =(int)vv2;
- }
- else
- {
- int i22=-(int)(-vv2);
- if(i22==vv2)
- i2=i22;
- else
- i2=i22-1;
- }
- Real ii1=vv1_-i1;
- Real ii2=vv2_-i2;
+ }
+ else
+ {
+ int i22=-(int)(-vv2);
+ if(i22==vv2)
+ i2=i22;
+ else
+ i2=i22-1;
+ }
+ Real ii1=vv1_-i1;
+ Real ii2=vv2_-i2;
int which = ((ii1<tile_gap)||(ii2<tile_gap));
results.set(i, values[which]);
}
@@ -253,34 +253,34 @@
for(;i<rays.rayEnd;i++){
Real vv1 = Dot(rays.getTexCoords(i), v1);
Real vv2 = Dot(rays.getTexCoords(i), v2);
- Real vv1_=vv1;
+ Real vv1_=vv1;
Real vv2_=vv2;
- int i1;
- int i2;
+ int i1;
+ int i2;
if(vv1>0){
i1 =(int)vv1;
- }
- else
- {
- int i11=-(int)(-vv1);
- if(i11==vv1)
- i1=i11;
- else
- i1=i11-1;
- }
- if(vv2>0){
+ }
+ else
+ {
+ int i11=-(int)(-vv1);
+ if(i11==vv1)
+ i1=i11;
+ else
+ i1=i11-1;
+ }
+ if(vv2>0){
i2 =(int)vv2;
- }
- else
- {
- int i22=-(int)(-vv2);
- if(i22==vv2)
- i2=i22;
- else
- i2=i22-1;
- }
- Real ii1=vv1_-i1;
- Real ii2=vv2_-i2;
+ }
+ else
+ {
+ int i22=-(int)(-vv2);
+ if(i22==vv2)
+ i2=i22;
+ else
+ i2=i22-1;
+ }
+ Real ii1=vv1_-i1;
+ Real ii2=vv2_-i2;
int which = ((ii1<tile_gap)||(ii2<tile_gap));
results.set(i, values[which]);
}
- [MANTA] r1599 - in trunk: Engine/Shadows Model/AmbientLights Model/Backgrounds Model/Cameras Model/Groups Model/Lights Model/Materials Model/Primitives Model/TexCoordMappers Model/Textures, boulos, 08/01/2007
Archive powered by MHonArc 2.6.16.