diff --git a/Source/Engine/Graphics/RenderBuffers.h b/Source/Engine/Graphics/RenderBuffers.h
index 264a22db9..0e3aef27d 100644
--- a/Source/Engine/Graphics/RenderBuffers.h
+++ b/Source/Engine/Graphics/RenderBuffers.h
@@ -7,9 +7,6 @@
#include "Engine/Scripting/ScriptingObject.h"
#include "Engine/Graphics/Textures/GPUTexture.h"
-// Default motion vectors buffer pixel format (can fallback to other format if not supported)
-#define MOTION_VECTORS_PIXEL_FORMAT PixelFormat::R16G16_Float
-
// GBuffer render targets formats
#define GBUFFER0_FORMAT PixelFormat::R8G8B8A8_UNorm
#define GBUFFER1_FORMAT PixelFormat::R10G10B10A2_UNorm
@@ -29,7 +26,7 @@ API_CLASS() class FLAXENGINE_API RenderBuffers : public ScriptingObject
///
/// The custom rendering state.
///
- class CustomBuffer : public Object
+ class FLAXENGINE_API CustomBuffer : public Object
{
public:
String Name;
diff --git a/Source/Engine/Renderer/GBufferPass.cpp b/Source/Engine/Renderer/GBufferPass.cpp
index b4d138db8..c424eb951 100644
--- a/Source/Engine/Renderer/GBufferPass.cpp
+++ b/Source/Engine/Renderer/GBufferPass.cpp
@@ -381,7 +381,7 @@ void GBufferPass::DrawSky(RenderContext& renderContext, GPUContext* context)
// Calculate sphere model transform to cover far plane
Matrix m1, m2;
- Matrix::Scaling(renderContext.View.Far / (box.GetSize().Y * 0.5f) * 0.95f, m1); // Scale to fit whole view frustum
+ Matrix::Scaling(renderContext.View.Far / ((float)box.GetSize().Y * 0.5f) * 0.95f, m1); // Scale to fit whole view frustum
Matrix::CreateWorld(renderContext.View.Position, Float3::Up, Float3::Backward, m2); // Rotate sphere model
m1 *= m2;
diff --git a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp
index d3d25c133..b13d070d2 100644
--- a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp
+++ b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp
@@ -1111,7 +1111,7 @@ void GlobalSurfaceAtlasPass::RasterizeActor(Actor* actor, void* actorObject, con
xAxis.NormalizeFast();
yAxis.NormalizeFast();
zAxis.NormalizeFast();
- object->Bounds.Transformation.LocalToWorld(localSpaceOffset, tile->ViewPosition);
+ tile->ViewPosition = object->Bounds.Transformation.LocalToWorld(localSpaceOffset);
tile->ViewDirection = zAxis;
// Create view matrix
diff --git a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp
index 0cd7c977e..4ef038efd 100644
--- a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp
+++ b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp
@@ -127,7 +127,7 @@ struct CascadeData
{
GPUTexture* Texture = nullptr;
GPUTexture* Mip = nullptr;
- Vector3 Position;
+ Float3 Position;
float VoxelSize;
BoundingBox Bounds;
HashSet NonEmptyChunks;
@@ -478,12 +478,12 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
sdfData.ListenSceneRendering(scene);
// Calculate origin for Global SDF by shifting it towards the view direction to account for better view frustum coverage
- Vector3 viewOrigin = renderContext.View.Position;
+ Float3 viewOrigin = renderContext.View.Position;
{
- Vector3 viewDirection = renderContext.View.Direction;
+ Float3 viewDirection = renderContext.View.Direction;
const float cascade0Distance = distanceExtent * cascadesDistanceScales[0];
const Vector2 viewRayHit = CollisionsHelper::LineHitsBox(viewOrigin, viewOrigin + viewDirection * (cascade0Distance * 2.0f), viewOrigin - cascade0Distance, viewOrigin + cascade0Distance);
- const float viewOriginOffset = viewRayHit.Y * cascade0Distance * 0.6f;
+ const float viewOriginOffset = (float)viewRayHit.Y * cascade0Distance * 0.6f;
viewOrigin += viewDirection * viewOriginOffset;
}
@@ -509,8 +509,8 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
const float cascadeVoxelSize = cascadeMaxDistance / (float)resolution;
const float cascadeChunkSize = cascadeVoxelSize * GLOBAL_SDF_RASTERIZE_CHUNK_SIZE;
static_assert(GLOBAL_SDF_RASTERIZE_CHUNK_SIZE % GLOBAL_SDF_RASTERIZE_MIP_FACTOR == 0, "Adjust chunk size to match the mip factor scale.");
- const Vector3 center = Vector3::Floor(viewOrigin / cascadeChunkSize) * cascadeChunkSize;
- //const Vector3 center = Vector3::Zero;
+ const Float3 center = Float3::Floor(viewOrigin / cascadeChunkSize) * cascadeChunkSize;
+ //const Float3 center = Float3::Zero;
BoundingBox cascadeBounds(center - cascadeDistance, center + cascadeDistance);
// TODO: add scene detail scale factor to PostFx settings (eg. to increase or decrease scene details and quality)
const float minObjectRadius = Math::Max(20.0f, cascadeVoxelSize * 0.5f); // Skip too small objects for this cascade
@@ -526,7 +526,7 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
}
// Check if cascade center has been moved
- if (!(useCache && Vector3::NearEqual(cascade.Position, center, cascadeVoxelSize)))
+ if (!(useCache && Float3::NearEqual(cascade.Position, center, cascadeVoxelSize)))
{
// TODO: optimize for moving camera (copy sdf for cached chunks)
cascade.StaticChunks.Clear();
@@ -683,7 +683,7 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
count += chunks[tmp].ModelsCount + chunks[tmp].HeightfieldsCount;
tmp.NextLayer();
}
- Vector3 chunkMin = cascadeBounds.Minimum + Vector3(e.Key.Coord) * chunkSize;
+ Float3 chunkMin = cascadeBounds.Minimum + Float3(e.Key.Coord) * chunkSize;
BoundingBox chunkBounds(chunkMin, chunkMin + chunkSize);
DebugDraw::DrawWireBox(chunkBounds, Color::Red, 0, false);
DebugDraw::DrawText(StringUtils::ToString(count), chunkBounds.GetCenter(), Color::Red);
@@ -779,8 +779,8 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
const float cascadeDistance = distanceExtent * cascadesDistanceScales[cascadeIndex];
const float cascadeMaxDistance = cascadeDistance * 2;
const float cascadeVoxelSize = cascadeMaxDistance / resolution;
- const Vector3 center = cascade.Position;
- result.Constants.CascadePosDistance[cascadeIndex] = Vector4(center, cascadeDistance);
+ const Float3 center = cascade.Position;
+ result.Constants.CascadePosDistance[cascadeIndex] = Float4(center, cascadeDistance);
result.Constants.CascadeVoxelSize.Raw[cascadeIndex] = cascadeVoxelSize;
result.Cascades[cascadeIndex] = cascade.Texture;
result.CascadeMips[cascadeIndex] = cascade.Mip;
@@ -815,7 +815,7 @@ void GlobalSignDistanceFieldPass::RenderDebug(RenderContext& renderContext, GPUC
data.ViewNearPlane = renderContext.View.Near;
data.ViewFarPlane = renderContext.View.Far;
for (int32 i = 0; i < 4; i++)
- data.ViewFrustumWorldRays[i] = Vector4(renderContext.List->FrustumCornersWs[i + 4], 0);
+ data.ViewFrustumWorldRays[i] = Float4(renderContext.List->FrustumCornersWs[i + 4], 0);
data.GlobalSDF = bindingData.Constants;
context->UpdateCB(_cb0, &data);
context->BindCB(0, _cb0);
@@ -846,7 +846,7 @@ void GlobalSignDistanceFieldPass::RasterizeModelSDF(Actor* actor, const ModelBas
Matrix worldToLocal, volumeToWorld;
Matrix::Invert(localToWorld, worldToLocal);
BoundingBox localVolumeBounds(sdf.LocalBoundsMin, sdf.LocalBoundsMax);
- Vector3 volumeLocalBoundsExtent = localVolumeBounds.GetSize() * 0.5f;
+ Float3 volumeLocalBoundsExtent = localVolumeBounds.GetSize() * 0.5f;
Matrix worldToVolume = worldToLocal * Matrix::Translation(-(localVolumeBounds.Minimum + volumeLocalBoundsExtent));
Matrix::Invert(worldToVolume, volumeToWorld);
diff --git a/Source/Engine/Renderer/MotionBlurPass.cpp b/Source/Engine/Renderer/MotionBlurPass.cpp
index 48602e707..850933f05 100644
--- a/Source/Engine/Renderer/MotionBlurPass.cpp
+++ b/Source/Engine/Renderer/MotionBlurPass.cpp
@@ -61,7 +61,7 @@ bool MotionBlurPass::Init()
#endif
// Prepare formats for the buffers
- auto format = MOTION_VECTORS_PIXEL_FORMAT;
+ auto format = PixelFormat::R16G16_Float;
if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(format).Support, FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D))
{
if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(PixelFormat::R32G32_Float).Support, FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D))