Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1669 - in trunk: Model/Textures SwigInterface


Chronological Thread 
  • From: leenak@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1669 - in trunk: Model/Textures SwigInterface
  • Date: Mon, 20 Aug 2007 17:42:11 -0600 (MDT)

Author: leenak
Date: Mon Aug 20 17:42:11 2007
New Revision: 1669

Modified:
   trunk/Model/Textures/CloudTexture.h
   trunk/SwigInterface/manta.i
Log:
Changes have been made to cloud texture class

Modified: trunk/Model/Textures/CloudTexture.h
==============================================================================
--- trunk/Model/Textures/CloudTexture.h (original)
+++ trunk/Model/Textures/CloudTexture.h Mon Aug 20 17:42:11 2007
@@ -1,8 +1,9 @@
 
 /*
- * This texture class takes two arguments.
- * First one indicates coverage of cloud in the sky(0-1) and
- * Second one indicates the dimension in which clouds occur(0, 1 or 2) 
+ * This texture class takes three arguments.
+ * First one indicates the color of the sky, which can be either blue or 
black)
+ * Second one indicates coverage of cloud in the sky(0-1) and
+ * Third one indicates the dimension in which clouds occur(0, 1 or 2) 
  * 0 indicates x-axis, 1 indicates y-axis and 2 z-axis.
  *
  */
@@ -24,7 +25,7 @@
   template< typename ValueType >
   class CloudTexture : public Texture< ValueType > {
     public:
-    CloudTexture( Real const cloud_cover, Real const cloud_coordinate );
+    CloudTexture( ValueType const &Skycolor, Real const cloud_cover, int 
const cloud_coordinate );
     virtual ~CloudTexture();
     virtual void mapValues(Packet<Color>& results,
                            const RenderContext&,
@@ -43,16 +44,16 @@
     int octaves;
     Real lacunarity;
     Real gain;
-    Real cloud_coordinate;
+    int cloud_coordinate;
     Real cloud_cover;
   };
 
   template< class ValueType >
-  CloudTexture< ValueType >::CloudTexture( Real const cloud_cover, Real 
const cloud_coordinate)      
+               CloudTexture< ValueType >::CloudTexture(ValueType const 
&Skycolor, Real const cloud_cover, int const cloud_coordinate)      
                : cloud_cover( cloud_cover ),
       cloud_coordinate(cloud_coordinate)
   {
-    skycolor=Color(RGBColor(1,1,1))-Color(RGBColor(0,0,1));
+    skycolor=Color(RGBColor(1,1,1))-Skycolor;
     scale=0.1;
     fscale=1;
     tscale=1;
@@ -71,29 +72,37 @@
                                              const RenderContext& context,
                                              RayPacket& rays) const
   {
+    enum cloud_dimension {
+                       x_coordinate ,
+      y_coordinate ,
+      z_coordinate
+    };
+
     rays.computeTextureCoordinates3( context );
     for( int i = rays.begin(); i < rays.end(); i++ ) {
      
       Vector T = rays.getTexCoords(i) * (scale * tscale);
       ColorComponent density;
       ColorComponent value;
+     
+      switch(cloud_coordinate) {
+                       case x_coordinate:
+        
+                               
density=cloud_coverage(rays.getTexCoords(i).x());
+                               value =(( rays.getTexCoords(i).x()) * fscale 
+ (Real)Turbulence( T, octaves, lacunarity, gain ));
+        break;
+      case y_coordinate:
+        
+                               
density=cloud_coverage(rays.getTexCoords(i).y());
+                               value =(( rays.getTexCoords(i).y()) * fscale 
+ (Real)Turbulence( T, octaves, lacunarity, gain ));
+        break;
+      case z_coordinate:
        
-      if(cloud_coordinate==0)
-      {
-       density=cloud_coverage(rays.getTexCoords(i).x());
-       value =(( rays.getTexCoords(i).x()) * fscale + (Real)Turbulence( T, 
octaves, lacunarity, gain ));
-      }
-      if(cloud_coordinate==1)
-      {
-       density=cloud_coverage(rays.getTexCoords(i).y());
-       value =(( rays.getTexCoords(i).y()) * fscale + (Real)Turbulence( T, 
octaves, lacunarity, gain ));
-      }
-      if(cloud_coordinate==2)
-      {
-       density=cloud_coverage(rays.getTexCoords(i).z());
-       value =(( rays.getTexCoords(i).z()) * fscale + (Real)Turbulence( T, 
octaves, lacunarity, gain ));
+                               
density=cloud_coverage(rays.getTexCoords(i).z());
+                               value =(( rays.getTexCoords(i).z()) * fscale 
+ (Real)Turbulence( T, octaves, lacunarity, gain ));
+        break;
       }
-      
+          
       value=value*(Real)0.5+(Real)0.5;
       value=value*density;
       value=value*(Real)0.5+(Real)0.5;

Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Mon Aug 20 17:42:11 2007
@@ -200,7 +200,7 @@
   %warnfilter(404) Texture<Manta::ColorComponent>;
   %warnfilter(404) CheckerTexture<Manta::ColorComponent>;
   %warnfilter(404) TileTexture<Manta::ColorComponent>;
-
+  
   %template(Texture_Color) Texture<Color>;
   %template(Texture_Real) Texture<Manta::Real>;
   %template(Texture_ColorComponent) Texture<Manta::ColorComponent>; 




  • [Manta] r1669 - in trunk: Model/Textures SwigInterface, leenak, 08/20/2007

Archive powered by MHonArc 2.6.16.

Top of page