Browse Source

Planar reflections won't be supported this iteration (way too expensive to use in majority of cases anyway)

BearishSun 8 years ago
parent
commit
96af487db1

+ 4 - 17
Source/BansheeCore/Include/BsReflectionProbe.h

@@ -27,12 +27,7 @@ namespace bs
 		 * Reflection probe cubemap is generated, but sphere is used for calculating the influence radius and
 		 * Reflection probe cubemap is generated, but sphere is used for calculating the influence radius and
 		 * proxy geometry. 
 		 * proxy geometry. 
 		 */
 		 */
-		Sphere,
-		/**
-		 * Reflection probe 2D texture is generated instead of a cubemap. This texture corresponds to the -Z direction face
-		 * of the cubemap.
-		 */
-		Plane
+		Sphere
 	};
 	};
 
 
 	/**	Signals which portion of a reflection probe is dirty. */
 	/**	Signals which portion of a reflection probe is dirty. */
@@ -89,10 +84,10 @@ namespace bs
 		/** Sets the radius of a sphere reflection probe. */
 		/** Sets the radius of a sphere reflection probe. */
 		void setRadius(float radius) { mRadius = radius; _markCoreDirty(); updateBounds(); }
 		void setRadius(float radius) { mRadius = radius; _markCoreDirty(); updateBounds(); }
 
 
-		/** Returns the extents of a box or plane reflection probe. */
+		/** Returns the extents of a box reflection probe. */
 		Vector3 getExtents() const { return mExtents * mScale; }
 		Vector3 getExtents() const { return mExtents * mScale; }
 
 
-		/** Sets the extents of a box or a plane reflection probe. Determines range of influence. */
+		/** Sets the extents of a box reflection probe. Determines range of influence. */
 		void setExtents(const Vector3& extents) { mExtents = extents; _markCoreDirty(); updateBounds(); }
 		void setExtents(const Vector3& extents) { mExtents = extents; _markCoreDirty(); updateBounds(); }
 
 
 		/**	Returns world space bounds that completely encompass the probe's area of influence. */
 		/**	Returns world space bounds that completely encompass the probe's area of influence. */
@@ -132,7 +127,7 @@ namespace bs
 
 
 		ReflectionProbeType mType; /**< Type of probe that determines how are the rest of the parameters interpreted. */
 		ReflectionProbeType mType; /**< Type of probe that determines how are the rest of the parameters interpreted. */
 		float mRadius; /**< Radius used for sphere reflection probes. */
 		float mRadius; /**< Radius used for sphere reflection probes. */
-		Vector3 mExtents; /**< Extents used by box & plane reflection probes. */
+		Vector3 mExtents; /**< Extents used by box reflection probe. */
 		float mTransitionDistance; /**< Extra distance to used for fading out box probes. */
 		float mTransitionDistance; /**< Extra distance to used for fading out box probes. */
 		String mUUID; /**< Identifier that uniquely identifies the probe. */
 		String mUUID; /**< Identifier that uniquely identifies the probe. */
 
 
@@ -215,14 +210,6 @@ namespace bs
 		 */
 		 */
 		static SPtr<ReflectionProbe> createBox(const Vector3& extents);
 		static SPtr<ReflectionProbe> createBox(const Vector3& extents);
 
 
-		/**
-		 * Creates a new plane reflection probe.
-		 *
-		 * @param[in]	extents	Extents of the box in which the reflection probe will be rendered within.
-		 * @returns				New reflection probe.
-		 */
-		static SPtr<ReflectionProbe> createPlane(const Vector3& extents);
-
 	protected:
 	protected:
 		ReflectionProbe(ReflectionProbeType type, float radius, const Vector3& extents);
 		ReflectionProbe(ReflectionProbeType type, float radius, const Vector3& extents);
 
 

+ 0 - 12
Source/BansheeCore/Source/BsReflectionProbe.cpp

@@ -28,7 +28,6 @@ namespace bs
 			mBounds = Sphere(mPosition, mRadius * std::max(std::max(mScale.x, mScale.y), mScale.z));
 			mBounds = Sphere(mPosition, mRadius * std::max(std::max(mScale.x, mScale.y), mScale.z));
 			break;
 			break;
 		case ReflectionProbeType::Box:
 		case ReflectionProbeType::Box:
-		case ReflectionProbeType::Plane:
 			mBounds = Sphere(mPosition, (mExtents * mScale).length());
 			mBounds = Sphere(mPosition, (mExtents * mScale).length());
 			break;
 			break;
 		}
 		}
@@ -94,17 +93,6 @@ namespace bs
 		return probePtr;
 		return probePtr;
 	}
 	}
 
 
-	SPtr<ReflectionProbe> ReflectionProbe::createPlane(const Vector3& extents)
-	{
-		ReflectionProbe* probe = new (bs_alloc<ReflectionProbe>()) ReflectionProbe(ReflectionProbeType::Plane, 0.0f, extents);
-		SPtr<ReflectionProbe> probePtr = bs_core_ptr<ReflectionProbe>(probe);
-		probePtr->_setThisPtr(probePtr);
-		probePtr->mUUID = UUIDGenerator::generateRandom();
-		probePtr->initialize();
-
-		return probePtr;
-	}
-
 	SPtr<ReflectionProbe> ReflectionProbe::createEmpty()
 	SPtr<ReflectionProbe> ReflectionProbe::createEmpty()
 	{
 	{
 		ReflectionProbe* probe = new (bs_alloc<ReflectionProbe>()) ReflectionProbe();
 		ReflectionProbe* probe = new (bs_alloc<ReflectionProbe>()) ReflectionProbe();

+ 33 - 39
Source/RenderBeast/Source/BsRenderBeast.cpp

@@ -468,31 +468,28 @@ namespace bs { namespace ct
 		mReflProbeWorldBounds.push_back(probe->getBounds());
 		mReflProbeWorldBounds.push_back(probe->getBounds());
 
 
 		// Find a spot in cubemap array
 		// Find a spot in cubemap array
-		if(probe->getType() != ReflectionProbeType::Plane)
+		UINT32 numArrayEntries = (UINT32)mCubemapArrayUsedSlots.size();
+		for(UINT32 i = 0; i < numArrayEntries; i++)
 		{
 		{
-			UINT32 numArrayEntries = (UINT32)mCubemapArrayUsedSlots.size();
-			for(UINT32 i = 0; i < numArrayEntries; i++)
+			if(!mCubemapArrayUsedSlots[i])
 			{
 			{
-				if(!mCubemapArrayUsedSlots[i])
-				{
-					probeInfo.arrayIdx = i;
-					mCubemapArrayUsedSlots[i] = true;
-					break;
-				}
+				probeInfo.arrayIdx = i;
+				mCubemapArrayUsedSlots[i] = true;
+				break;
 			}
 			}
+		}
 
 
-			// No empty slot was found
-			if (probeInfo.arrayIdx == -1)
-			{
-				probeInfo.arrayIdx = numArrayEntries;
-				mCubemapArrayUsedSlots.push_back(true);
-			}
+		// No empty slot was found
+		if (probeInfo.arrayIdx == -1)
+		{
+			probeInfo.arrayIdx = numArrayEntries;
+			mCubemapArrayUsedSlots.push_back(true);
+		}
 
 
-			if(probeInfo.arrayIdx > MaxReflectionCubemaps)
-			{
-				LOGERR("Reached the maximum number of allowed reflection probe cubemaps at once. "
-					"Ignoring reflection probe data.");
-			}
+		if(probeInfo.arrayIdx > MaxReflectionCubemaps)
+		{
+			LOGERR("Reached the maximum number of allowed reflection probe cubemaps at once. "
+				"Ignoring reflection probe data.");
 		}
 		}
 	}
 	}
 
 
@@ -1314,33 +1311,30 @@ namespace bs { namespace ct
 				if (probeInfo.arrayIdx > MaxReflectionCubemaps)
 				if (probeInfo.arrayIdx > MaxReflectionCubemaps)
 					continue;
 					continue;
 
 
-				if (probeInfo.probe->getType() != ReflectionProbeType::Plane)
+				if (probeInfo.texture == nullptr)
+					probeInfo.texture = LightProbeCache::instance().getCachedRadianceTexture(probeInfo.probe->getUUID());
+
+				if (probeInfo.texture == nullptr || probeInfo.textureDirty)
 				{
 				{
-					if (probeInfo.texture == nullptr)
-						probeInfo.texture = LightProbeCache::instance().getCachedRadianceTexture(probeInfo.probe->getUUID());
+					probeInfo.texture = Texture::create(cubemapDesc);
 
 
-					if (probeInfo.texture == nullptr || probeInfo.textureDirty)
+					if (!probeInfo.customTexture)
 					{
 					{
-						probeInfo.texture = Texture::create(cubemapDesc);
-
-						if (!probeInfo.customTexture)
-						{
-							captureSceneCubeMap(probeInfo.texture, probeInfo.probe->getPosition(), true, frameInfo);
-						}
-						else
-						{
-							SPtr<Texture> customTexture = probeInfo.probe->getCustomTexture();
-							IBLUtility::scaleCubemap(customTexture, 0, probeInfo.texture, 0);
-						}
-
-						IBLUtility::filterCubemapForSpecular(probeInfo.texture, scratchCubemap);
-						LightProbeCache::instance().setCachedRadianceTexture(probeInfo.probe->getUUID(), probeInfo.texture);
+						captureSceneCubeMap(probeInfo.texture, probeInfo.probe->getPosition(), true, frameInfo);
 					}
 					}
+					else
+					{
+						SPtr<Texture> customTexture = probeInfo.probe->getCustomTexture();
+						IBLUtility::scaleCubemap(customTexture, 0, probeInfo.texture, 0);
+					}
+
+					IBLUtility::filterCubemapForSpecular(probeInfo.texture, scratchCubemap);
+					LightProbeCache::instance().setCachedRadianceTexture(probeInfo.probe->getUUID(), probeInfo.texture);
 				}
 				}
 
 
 				probeInfo.textureDirty = false;
 				probeInfo.textureDirty = false;
 
 
-				if(probeInfo.probe->getType() != ReflectionProbeType::Plane && (probeInfo.arrayDirty || forceArrayUpdate))
+				if(probeInfo.arrayDirty || forceArrayUpdate)
 				{
 				{
 					auto& srcProps = probeInfo.texture->getProperties();
 					auto& srcProps = probeInfo.texture->getProperties();
 					bool isValid = srcProps.getWidth() == IBLUtility::REFLECTION_CUBEMAP_SIZE && 
 					bool isValid = srcProps.getWidth() == IBLUtility::REFLECTION_CUBEMAP_SIZE &&