More work for large worlds
This commit is contained in:
@@ -617,14 +617,14 @@ void PS_Depth(PixelInput input)
|
|||||||
|
|
||||||
#if _PS_QuadOverdraw
|
#if _PS_QuadOverdraw
|
||||||
|
|
||||||
//#include "./Flax/Editor/QuadOverdraw.hlsl"
|
#include "./Flax/Editor/QuadOverdraw.hlsl"
|
||||||
|
|
||||||
// Pixel Shader function for Quad Overdraw Pass (editor-only)
|
// Pixel Shader function for Quad Overdraw Pass (editor-only)
|
||||||
[earlydepthstencil]
|
[earlydepthstencil]
|
||||||
META_PS(USE_EDITOR, FEATURE_LEVEL_SM5)
|
META_PS(USE_EDITOR, FEATURE_LEVEL_SM5)
|
||||||
void PS_QuadOverdraw(float4 svPos : SV_Position, uint primId : SV_PrimitiveID)
|
void PS_QuadOverdraw(float4 svPos : SV_Position, uint primId : SV_PrimitiveID)
|
||||||
{
|
{
|
||||||
//DoQuadOverdraw(svPos, primId);
|
DoQuadOverdraw(svPos, primId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
BIN
Content/Engine/DefaultMaterial.flax
(Stored with Git LFS)
BIN
Content/Engine/DefaultMaterial.flax
(Stored with Git LFS)
Binary file not shown.
@@ -3,6 +3,7 @@
|
|||||||
#include "BoundingBox.h"
|
#include "BoundingBox.h"
|
||||||
#include "BoundingSphere.h"
|
#include "BoundingSphere.h"
|
||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
|
#include "Transform.h"
|
||||||
#include "../Types/String.h"
|
#include "../Types/String.h"
|
||||||
|
|
||||||
const BoundingBox BoundingBox::Empty(Vector3(MAX_float), Vector3(MIN_float));
|
const BoundingBox BoundingBox::Empty(Vector3(MAX_float), Vector3(MIN_float));
|
||||||
@@ -147,3 +148,11 @@ void BoundingBox::Transform(const BoundingBox& box, const Matrix& matrix, Boundi
|
|||||||
result = FromPoints(corners, 8);
|
result = FromPoints(corners, 8);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BoundingBox::Transform(const BoundingBox& box, const ::Transform& transform, BoundingBox& result)
|
||||||
|
{
|
||||||
|
// TODO: optimize it and support large worlds without using Matrix
|
||||||
|
Matrix matrix;
|
||||||
|
transform.GetWorld(matrix);
|
||||||
|
Transform(box, matrix, result);
|
||||||
|
}
|
||||||
|
|||||||
@@ -296,6 +296,14 @@ public:
|
|||||||
/// <param name="result">The result transformed box.</param>
|
/// <param name="result">The result transformed box.</param>
|
||||||
static void Transform(const BoundingBox& box, const Matrix& matrix, BoundingBox& result);
|
static void Transform(const BoundingBox& box, const Matrix& matrix, BoundingBox& result);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Transforms the bounding box using the specified transformation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="box">The box.</param>
|
||||||
|
/// <param name="transform">The transformation.</param>
|
||||||
|
/// <param name="result">The result transformed box.</param>
|
||||||
|
static void Transform(const BoundingBox& box, const ::Transform& transform, BoundingBox& result);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if there is an intersection between the current object and a Ray.
|
/// Determines if there is an intersection between the current object and a Ray.
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ Decal::Decal(const SpawnParams& params)
|
|||||||
: Actor(params)
|
: Actor(params)
|
||||||
, _size(100.0f)
|
, _size(100.0f)
|
||||||
{
|
{
|
||||||
_world = Matrix::Scaling(_size);
|
_bounds.Extents = _size * 0.5f;
|
||||||
_bounds.Extents = Vector3::Half;
|
_bounds.Transformation = _transform;
|
||||||
_world.Decompose(_bounds.Transformation);
|
|
||||||
_bounds.GetBoundingBox(_box);
|
_bounds.GetBoundingBox(_box);
|
||||||
BoundingSphere::FromBox(_box, _sphere);
|
BoundingSphere::FromBox(_box, _sphere);
|
||||||
}
|
}
|
||||||
@@ -26,12 +25,7 @@ void Decal::SetSize(const Vector3& value)
|
|||||||
if (v != _size)
|
if (v != _size)
|
||||||
{
|
{
|
||||||
_size = v;
|
_size = v;
|
||||||
|
_bounds.Extents = v * 0.5f;
|
||||||
Transform t = _transform;
|
|
||||||
t.Scale *= _size;
|
|
||||||
t.GetWorld(_world);
|
|
||||||
|
|
||||||
_bounds.Transformation = t;
|
|
||||||
_bounds.GetBoundingBox(_box);
|
_bounds.GetBoundingBox(_box);
|
||||||
BoundingSphere::FromBox(_box, _sphere);
|
BoundingSphere::FromBox(_box, _sphere);
|
||||||
}
|
}
|
||||||
@@ -81,7 +75,7 @@ void Decal::Draw(RenderContext& renderContext)
|
|||||||
Material->IsDecal())
|
Material->IsDecal())
|
||||||
{
|
{
|
||||||
const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View);
|
const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View);
|
||||||
const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(_sphere.Center, (float)_sphere.Radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt;
|
const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(_sphere.Center - renderContext.View.Origin, (float)_sphere.Radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt;
|
||||||
|
|
||||||
// Check if decal is being culled
|
// Check if decal is being culled
|
||||||
if (Math::Square(DrawMinScreenSize * 0.5f) > screenRadiusSquared)
|
if (Math::Square(DrawMinScreenSize * 0.5f) > screenRadiusSquared)
|
||||||
@@ -113,6 +107,8 @@ void Decal::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
|
|||||||
DESERIALIZE_MEMBER(Size, _size);
|
DESERIALIZE_MEMBER(Size, _size);
|
||||||
DESERIALIZE(SortOrder);
|
DESERIALIZE(SortOrder);
|
||||||
DESERIALIZE(DrawMinScreenSize);
|
DESERIALIZE(DrawMinScreenSize);
|
||||||
|
|
||||||
|
_bounds.Extents = _size * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Decal::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
|
bool Decal::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
|
||||||
@@ -147,12 +143,7 @@ void Decal::OnTransformChanged()
|
|||||||
// Base
|
// Base
|
||||||
Actor::OnTransformChanged();
|
Actor::OnTransformChanged();
|
||||||
|
|
||||||
Transform t = _transform;
|
_bounds.Transformation = _transform;
|
||||||
t.Scale *= _size;
|
|
||||||
t.GetWorld(_world);
|
|
||||||
|
|
||||||
_bounds.Extents = Vector3::Half;
|
|
||||||
_bounds.Transformation = t;
|
|
||||||
_bounds.GetBoundingBox(_box);
|
_bounds.GetBoundingBox(_box);
|
||||||
BoundingSphere::FromBox(_box, _sphere);
|
BoundingSphere::FromBox(_box, _sphere);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ API_CLASS() class FLAXENGINE_API Decal : public Actor
|
|||||||
private:
|
private:
|
||||||
Vector3 _size;
|
Vector3 _size;
|
||||||
OrientedBoundingBox _bounds;
|
OrientedBoundingBox _bounds;
|
||||||
Matrix _world;
|
|
||||||
int32 _sceneRenderingKey = -1;
|
int32 _sceneRenderingKey = -1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -61,15 +60,6 @@ public:
|
|||||||
/// <returns>The created virtual material instance.</returns>
|
/// <returns>The created virtual material instance.</returns>
|
||||||
API_FUNCTION() MaterialInstance* CreateAndSetVirtualMaterialInstance();
|
API_FUNCTION() MaterialInstance* CreateAndSetVirtualMaterialInstance();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the decal world matrix used to transform the 1x1x1 cube from the mesh space to world space.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="result">The result value container.</param>
|
|
||||||
FORCE_INLINE void GetWorld(Matrix* result) const
|
|
||||||
{
|
|
||||||
*result = _world;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// [Actor]
|
// [Actor]
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ void MaterialComplexityMaterialShader::Draw(RenderContext& renderContext, GPUCon
|
|||||||
{
|
{
|
||||||
const auto decal = decals[i];
|
const auto decal = decals[i];
|
||||||
ASSERT(decal && decal->Material);
|
ASSERT(decal && decal->Material);
|
||||||
decal->GetWorld(&drawCall.World);
|
Transform transform = decal->GetTransform();
|
||||||
|
transform.Scale *= decal->GetSize();
|
||||||
|
renderContext.View.GetWorldMatrix(transform, drawCall.World);
|
||||||
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
||||||
drawCall.Material = decal->Material;
|
drawCall.Material = decal->Material;
|
||||||
drawCall.PerInstanceRandom = decal->GetPerInstanceRandom();
|
drawCall.PerInstanceRandom = decal->GetPerInstanceRandom();
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ void QuadOverdrawPass::Render(RenderContext& renderContext, GPUContext* context,
|
|||||||
{
|
{
|
||||||
const auto decal = renderContext.List->Decals[i];
|
const auto decal = renderContext.List->Decals[i];
|
||||||
ASSERT(decal && decal->Material);
|
ASSERT(decal && decal->Material);
|
||||||
decal->GetWorld(&drawCall.World);
|
Transform transform = decal->GetTransform();
|
||||||
|
transform.Scale *= decal->GetSize();
|
||||||
|
renderContext.View.GetWorldMatrix(transform, drawCall.World);
|
||||||
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
||||||
drawCall.PerInstanceRandom = decal->GetPerInstanceRandom();
|
drawCall.PerInstanceRandom = decal->GetPerInstanceRandom();
|
||||||
defaultMaterial->Bind(bindParams);
|
defaultMaterial->Bind(bindParams);
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ void GBufferPass::DrawDecals(RenderContext& renderContext, GPUTextureView* light
|
|||||||
|
|
||||||
// Cache data
|
// Cache data
|
||||||
auto device = GPUDevice::Instance;
|
auto device = GPUDevice::Instance;
|
||||||
auto gpuContext = device->GetMainContext();
|
auto context = device->GetMainContext();
|
||||||
auto& view = renderContext.View;
|
auto& view = renderContext.View;
|
||||||
auto model = _boxModel.Get();
|
auto model = _boxModel.Get();
|
||||||
auto buffers = renderContext.Buffers;
|
auto buffers = renderContext.Buffers;
|
||||||
@@ -415,7 +415,7 @@ void GBufferPass::DrawDecals(RenderContext& renderContext, GPUTextureView* light
|
|||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
DrawCall drawCall;
|
DrawCall drawCall;
|
||||||
MaterialBase::BindParameters bindParams(gpuContext, renderContext, drawCall);
|
MaterialBase::BindParameters bindParams(context, renderContext, drawCall);
|
||||||
drawCall.Material = nullptr;
|
drawCall.Material = nullptr;
|
||||||
drawCall.WorldDeterminantSign = 1.0f;
|
drawCall.WorldDeterminantSign = 1.0f;
|
||||||
|
|
||||||
@@ -424,10 +424,12 @@ void GBufferPass::DrawDecals(RenderContext& renderContext, GPUTextureView* light
|
|||||||
{
|
{
|
||||||
const auto decal = decals[i];
|
const auto decal = decals[i];
|
||||||
ASSERT(decal && decal->Material);
|
ASSERT(decal && decal->Material);
|
||||||
decal->GetWorld(&drawCall.World);
|
Transform transform = decal->GetTransform();
|
||||||
|
transform.Scale *= decal->GetSize();
|
||||||
|
renderContext.View.GetWorldMatrix(transform, drawCall.World);
|
||||||
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
||||||
|
|
||||||
gpuContext->ResetRenderTarget();
|
context->ResetRenderTarget();
|
||||||
|
|
||||||
// Bind output
|
// Bind output
|
||||||
const MaterialInfo& info = decal->Material->GetInfo();
|
const MaterialInfo& info = decal->Material->GetInfo();
|
||||||
@@ -455,22 +457,22 @@ void GBufferPass::DrawDecals(RenderContext& renderContext, GPUTextureView* light
|
|||||||
count++;
|
count++;
|
||||||
targetBuffers[2] = buffers->GBuffer1->View();
|
targetBuffers[2] = buffers->GBuffer1->View();
|
||||||
}
|
}
|
||||||
gpuContext->SetRenderTarget(nullptr, ToSpan(targetBuffers, count));
|
context->SetRenderTarget(nullptr, ToSpan(targetBuffers, count));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaterialDecalBlendingMode::Stain:
|
case MaterialDecalBlendingMode::Stain:
|
||||||
{
|
{
|
||||||
gpuContext->SetRenderTarget(buffers->GBuffer0->View());
|
context->SetRenderTarget(buffers->GBuffer0->View());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaterialDecalBlendingMode::Normal:
|
case MaterialDecalBlendingMode::Normal:
|
||||||
{
|
{
|
||||||
gpuContext->SetRenderTarget(buffers->GBuffer1->View());
|
context->SetRenderTarget(buffers->GBuffer1->View());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaterialDecalBlendingMode::Emissive:
|
case MaterialDecalBlendingMode::Emissive:
|
||||||
{
|
{
|
||||||
gpuContext->SetRenderTarget(lightBuffer);
|
context->SetRenderTarget(lightBuffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,8 +480,8 @@ void GBufferPass::DrawDecals(RenderContext& renderContext, GPUTextureView* light
|
|||||||
// Draw decal
|
// Draw decal
|
||||||
drawCall.PerInstanceRandom = decal->GetPerInstanceRandom();
|
drawCall.PerInstanceRandom = decal->GetPerInstanceRandom();
|
||||||
decal->Material->Bind(bindParams);
|
decal->Material->Bind(bindParams);
|
||||||
model->Render(gpuContext);
|
model->Render(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpuContext->ResetSR();
|
context->ResetSR();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ TextRender::TextRender(const SpawnParams& params)
|
|||||||
, _vb1(0, sizeof(VB1ElementType))
|
, _vb1(0, sizeof(VB1ElementType))
|
||||||
, _vb2(0, sizeof(VB2ElementType))
|
, _vb2(0, sizeof(VB2ElementType))
|
||||||
{
|
{
|
||||||
_world = Matrix::Identity;
|
|
||||||
_color = Color::White;
|
_color = Color::White;
|
||||||
_localBox = BoundingBox(Vector3::Zero);
|
_localBox = BoundingBox(Vector3::Zero);
|
||||||
_layoutOptions.Bounds = Rectangle(-100, -100, 200, 200);
|
_layoutOptions.Bounds = Rectangle(-100, -100, 200, 200);
|
||||||
@@ -106,7 +105,7 @@ void TextRender::UpdateLayout()
|
|||||||
_vb1.Clear();
|
_vb1.Clear();
|
||||||
_vb2.Clear();
|
_vb2.Clear();
|
||||||
_localBox = BoundingBox(Vector3::Zero);
|
_localBox = BoundingBox(Vector3::Zero);
|
||||||
BoundingBox::Transform(_localBox, _world, _box);
|
BoundingBox::Transform(_localBox, _transform, _box);
|
||||||
BoundingSphere::FromBox(_box, _sphere);
|
BoundingSphere::FromBox(_box, _sphere);
|
||||||
#if USE_PRECISE_MESH_INTERSECTS
|
#if USE_PRECISE_MESH_INTERSECTS
|
||||||
_collisionProxy.Clear();
|
_collisionProxy.Clear();
|
||||||
@@ -327,7 +326,7 @@ void TextRender::UpdateLayout()
|
|||||||
box = BoundingBox(_transform.Translation);
|
box = BoundingBox(_transform.Translation);
|
||||||
}
|
}
|
||||||
_localBox = box;
|
_localBox = box;
|
||||||
BoundingBox::Transform(_localBox, _world, _box);
|
BoundingBox::Transform(_localBox, _transform, _box);
|
||||||
BoundingSphere::FromBox(_box, _sphere);
|
BoundingSphere::FromBox(_box, _sphere);
|
||||||
if (_sceneRenderingKey != -1)
|
if (_sceneRenderingKey != -1)
|
||||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||||
@@ -348,8 +347,9 @@ void TextRender::Draw(RenderContext& renderContext)
|
|||||||
{
|
{
|
||||||
UpdateLayout();
|
UpdateLayout();
|
||||||
}
|
}
|
||||||
|
Matrix world;
|
||||||
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, _world);
|
renderContext.View.GetWorldMatrix(_transform, world);
|
||||||
|
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world);
|
||||||
|
|
||||||
const DrawPass drawModes = (DrawPass)(DrawModes & renderContext.View.Pass & (int32)renderContext.View.GetShadowsDrawPassMask(ShadowsMode));
|
const DrawPass drawModes = (DrawPass)(DrawModes & renderContext.View.Pass & (int32)renderContext.View.GetShadowsDrawPassMask(ShadowsMode));
|
||||||
if (_vb0.Data.Count() > 0 && drawModes != DrawPass::None)
|
if (_vb0.Data.Count() > 0 && drawModes != DrawPass::None)
|
||||||
@@ -357,7 +357,7 @@ void TextRender::Draw(RenderContext& renderContext)
|
|||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
// Disable motion blur effects in editor without play mode enabled to hide minor artifacts on objects moving
|
// Disable motion blur effects in editor without play mode enabled to hide minor artifacts on objects moving
|
||||||
if (!Editor::IsPlayMode)
|
if (!Editor::IsPlayMode)
|
||||||
_drawState.PrevWorld = _world;
|
_drawState.PrevWorld = world;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flush buffers
|
// Flush buffers
|
||||||
@@ -372,7 +372,7 @@ void TextRender::Draw(RenderContext& renderContext)
|
|||||||
|
|
||||||
// Setup draw call
|
// Setup draw call
|
||||||
DrawCall drawCall;
|
DrawCall drawCall;
|
||||||
drawCall.World = _world;
|
drawCall.World = world;
|
||||||
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
drawCall.ObjectPosition = drawCall.World.GetTranslation();
|
||||||
drawCall.Surface.GeometrySize = _localBox.GetSize();
|
drawCall.Surface.GeometrySize = _localBox.GetSize();
|
||||||
drawCall.Surface.PrevWorld = _drawState.PrevWorld;
|
drawCall.Surface.PrevWorld = _drawState.PrevWorld;
|
||||||
@@ -380,7 +380,7 @@ void TextRender::Draw(RenderContext& renderContext)
|
|||||||
drawCall.Surface.LightmapUVsArea = Rectangle::Empty;
|
drawCall.Surface.LightmapUVsArea = Rectangle::Empty;
|
||||||
drawCall.Surface.Skinning = nullptr;
|
drawCall.Surface.Skinning = nullptr;
|
||||||
drawCall.Surface.LODDitherFactor = 0.0f;
|
drawCall.Surface.LODDitherFactor = 0.0f;
|
||||||
drawCall.WorldDeterminantSign = Math::FloatSelect(_world.RotDeterminant(), 1, -1);
|
drawCall.WorldDeterminantSign = Math::FloatSelect(world.RotDeterminant(), 1, -1);
|
||||||
drawCall.PerInstanceRandom = GetPerInstanceRandom();
|
drawCall.PerInstanceRandom = GetPerInstanceRandom();
|
||||||
drawCall.Geometry.IndexBuffer = _ib.GetBuffer();
|
drawCall.Geometry.IndexBuffer = _ib.GetBuffer();
|
||||||
drawCall.Geometry.VertexBuffers[0] = _vb0.GetBuffer();
|
drawCall.Geometry.VertexBuffers[0] = _vb0.GetBuffer();
|
||||||
@@ -401,7 +401,7 @@ void TextRender::Draw(RenderContext& renderContext)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOMETRY_DRAW_STATE_EVENT_END(_drawState, _world);
|
GEOMETRY_DRAW_STATE_EVENT_END(_drawState, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
@@ -413,7 +413,7 @@ void TextRender::OnDebugDrawSelected()
|
|||||||
// Draw text bounds and layout bounds
|
// Draw text bounds and layout bounds
|
||||||
DEBUG_DRAW_WIRE_BOX(_box, Color::Orange, 0, true);
|
DEBUG_DRAW_WIRE_BOX(_box, Color::Orange, 0, true);
|
||||||
OrientedBoundingBox layoutBox(Vector3(-_layoutOptions.Bounds.GetUpperLeft(), 0), Vector3(-_layoutOptions.Bounds.GetBottomRight(), 0));
|
OrientedBoundingBox layoutBox(Vector3(-_layoutOptions.Bounds.GetUpperLeft(), 0), Vector3(-_layoutOptions.Bounds.GetBottomRight(), 0));
|
||||||
layoutBox.Transform(_world);
|
layoutBox.Transform(_transform);
|
||||||
DEBUG_DRAW_WIRE_BOX(layoutBox, Color::BlueViolet, 0, true);
|
DEBUG_DRAW_WIRE_BOX(layoutBox, Color::BlueViolet, 0, true);
|
||||||
|
|
||||||
// Base
|
// Base
|
||||||
@@ -433,7 +433,7 @@ bool TextRender::IntersectsItself(const Ray& ray, Real& distance, Vector3& norma
|
|||||||
#if USE_PRECISE_MESH_INTERSECTS
|
#if USE_PRECISE_MESH_INTERSECTS
|
||||||
if (_box.Intersects(ray))
|
if (_box.Intersects(ray))
|
||||||
{
|
{
|
||||||
return _collisionProxy.Intersects(ray, _world, distance, normal);
|
return _collisionProxy.Intersects(ray, _transform, distance, normal);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
@@ -522,8 +522,7 @@ void TextRender::OnTransformChanged()
|
|||||||
// Base
|
// Base
|
||||||
Actor::OnTransformChanged();
|
Actor::OnTransformChanged();
|
||||||
|
|
||||||
_transform.GetWorld(_world);
|
BoundingBox::Transform(_localBox, _transform, _box);
|
||||||
BoundingBox::Transform(_localBox, _world, _box);
|
|
||||||
BoundingSphere::FromBox(_box, _sphere);
|
BoundingSphere::FromBox(_box, _sphere);
|
||||||
if (_sceneRenderingKey != -1)
|
if (_sceneRenderingKey != -1)
|
||||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ private:
|
|||||||
int32 _sceneRenderingKey = -1;
|
int32 _sceneRenderingKey = -1;
|
||||||
|
|
||||||
BoundingBox _localBox;
|
BoundingBox _localBox;
|
||||||
Matrix _world;
|
|
||||||
GeometryDrawStateData _drawState;
|
GeometryDrawStateData _drawState;
|
||||||
DynamicIndexBuffer _ib;
|
DynamicIndexBuffer _ib;
|
||||||
DynamicVertexBuffer _vb0;
|
DynamicVertexBuffer _vb0;
|
||||||
|
|||||||
Reference in New Issue
Block a user