Commits

philiplb committed 5a2b07e

Volume Rendering: renamed the occurences of "normal" of the 3d texture source to
"gradient"

Comments (0)

Files changed (4)

Components/Volume/include/OgreVolumeTextureSource.h

         // Whether to use trilinear filtering or not for the value.
         const bool mTrilinearValue;
         
-        // Whether to use trilinear filtering or not for the normal.
-        const bool mTrilinearNormal;
+        // Whether to use trilinear filtering or not for the gradient.
+        const bool mTrilinearGradient;
 
-        /// Whether to blur the normal a bit Sobel like.
-        const bool mSobelNormal;
+        /// Whether to blur the gradient a bit Sobel like.
+        const bool mSobelGradient;
 
         /** Gets the volume value of a position.
         @param x
         */
         inline const Vector3 getGradient(size_t x, size_t y, size_t z) const
         {
-            if (mSobelNormal)
+            if (mSobelGradient)
             {
                 // Calculate gradient like in the original MC paper but mix a bit of Sobel in
                 return Vector3(
             The world depth.
         @param trilinearValue
             Whether to use trilinear filtering (true) or nearest neighbour (false) for the value.
-        @param trilinearNormal
-            Whether to use trilinear filtering (true) or nearest neighbour (false) for the normal.
-        @param sobelNormal
-            Whether to add a bit of blur to the normal like in a sobel filter.
+        @param trilinearGradient
+            Whether to use trilinear filtering (true) or nearest neighbour (false) for the gradient.
+        @param sobelGradient
+            Whether to add a bit of blur to the gradient like in a sobel filter.
         */
-        explicit TextureSource(const String &volumeTextureName, const Real worldWidth, const Real worldHeight, const Real worldDepth, const bool trilinearValue = true, const bool trilinearNormal = true, const bool sobelNormal = false);
+        explicit TextureSource(const String &volumeTextureName, const Real worldWidth, const Real worldHeight, const Real worldDepth, const bool trilinearValue = true, const bool trilinearGradient = true, const bool sobelGradient = false);
         
         /** Destructor.
         */

Components/Volume/src/OgreVolumeChunk.cpp

         String source = config.getSetting("source");
         Vector3 dimensions = StringConverter::parseVector3(config.getSetting("sourceDimensions"));
         bool trilinearValue = StringConverter::parseBool(config.getSetting("trilinearValue"));
-        bool trilinearNormal = StringConverter::parseBool(config.getSetting("trilinearNormal"));
-        bool sobelNormal = StringConverter::parseBool(config.getSetting("sobelNormal"));
+        bool trilinearGradient = StringConverter::parseBool(config.getSetting("trilinearGradient"));
+        bool sobelGradient = StringConverter::parseBool(config.getSetting("sobelGradient"));
 
-        TextureSource textureSource(source, dimensions.x, dimensions.y, dimensions.z, trilinearValue, trilinearNormal, sobelNormal);
+        TextureSource textureSource(source, dimensions.x, dimensions.y, dimensions.z, trilinearValue, trilinearGradient, sobelGradient);
     
         Vector3 from = StringConverter::parseVector3(config.getSetting("scanFrom"));
         Vector3 to = StringConverter::parseVector3(config.getSetting("scanTo"));

Components/Volume/src/OgreVolumeTextureSource.cpp

 namespace Ogre {
 namespace Volume {
 
-    TextureSource::TextureSource(const String &volumeTextureName, const Real worldWidth, const Real worldHeight, const Real worldDepth, const bool trilinearValue, const bool trilinearNormal, const bool sobelNormal) :
-        mTrilinearValue(trilinearValue), mTrilinearNormal(trilinearNormal), mSobelNormal(sobelNormal)
+    TextureSource::TextureSource(const String &volumeTextureName, const Real worldWidth, const Real worldHeight, const Real worldDepth, const bool trilinearValue, const bool trilinearGradient, const bool sobelGradient) :
+        mTrilinearValue(trilinearValue), mTrilinearGradient(trilinearGradient), mSobelGradient(sobelGradient)
     {
     
         Timer t;
     {
         Vector3 scaledPosition(position.x * mPosXScale, position.y * mPosYScale, position.z * mPosZScale);
         Vector3 normal;
-        if (mTrilinearNormal)
+        if (mTrilinearGradient)
         {
             size_t x0 = (size_t)scaledPosition.x;
             size_t x1 = (size_t)ceil(scaledPosition.x);

Samples/Media/volumeTerrain/volumeTerrain.cfg

 scale = 10.0
 # Whether to use trilinear interpolation for the source or not
 trilinearValue = true
-# Whether to use trilinear interpolation for the normals of the source or not
-trilinearNormal = false
-# Whether to use sobel filtering for the normals of the source or not
-sobelNormal = false
+# Whether to use trilinear interpolation for the gradients of the source or not
+trilinearGradient = false
+# Whether to use sobel filtering for the gradients of the source or not
+sobelGradient = false
 
 # Spatial part to scan and build the volume meshes from
 scanFrom = 0 0 0