Fixes and tweaks
This commit is contained in:
@@ -327,14 +327,6 @@ void AnimatedModel::SyncParameters()
|
||||
}
|
||||
}
|
||||
|
||||
void AnimatedModel::UpdateBounds()
|
||||
{
|
||||
UpdateLocalBounds();
|
||||
|
||||
BoundingBox::Transform(_boxLocal, _world, _box);
|
||||
BoundingSphere::FromBox(_box, _sphere);
|
||||
}
|
||||
|
||||
void AnimatedModel::BeginPlay(SceneBeginData* data)
|
||||
{
|
||||
if (SkinnedModel && SkinnedModel->IsLoaded())
|
||||
@@ -401,6 +393,14 @@ void AnimatedModel::UpdateLocalBounds()
|
||||
_boxLocal = box;
|
||||
}
|
||||
|
||||
void AnimatedModel::UpdateBounds()
|
||||
{
|
||||
UpdateLocalBounds();
|
||||
|
||||
BoundingBox::Transform(_boxLocal, _world, _box);
|
||||
BoundingSphere::FromBox(_box, _sphere);
|
||||
}
|
||||
|
||||
void AnimatedModel::OnAnimUpdate()
|
||||
{
|
||||
UpdateBounds();
|
||||
|
||||
@@ -290,6 +290,8 @@ private:
|
||||
/// </summary>
|
||||
void UpdateLocalBounds();
|
||||
|
||||
void UpdateBounds();
|
||||
|
||||
/// <summary>
|
||||
/// Called after animation graph update.
|
||||
/// </summary>
|
||||
@@ -317,7 +319,6 @@ public:
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
bool IntersectsEntry(int32 entryIndex, const Ray& ray, float& distance, Vector3& normal) override;
|
||||
bool IntersectsEntry(const Ray& ray, float& distance, Vector3& normal, int32& entryIndex) override;
|
||||
void UpdateBounds() final override;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -19,11 +19,6 @@ public:
|
||||
/// </summary>
|
||||
ModelInstanceEntries Entries;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the bounds of the actor.
|
||||
/// </summary>
|
||||
virtual void UpdateBounds() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model entries collection. Each entry contains data how to render meshes using this entry (transformation, material, shadows casting, etc.).
|
||||
/// </summary>
|
||||
@@ -63,7 +58,10 @@ public:
|
||||
/// <param name="distance">When the method completes and returns true, contains the distance of the intersection (if any valid).</param>
|
||||
/// <param name="normal">When the method completes, contains the intersection surface normal vector (if any valid).</param>
|
||||
/// <returns>True if the actor is intersected by the ray, otherwise false.</returns>
|
||||
API_FUNCTION() virtual bool IntersectsEntry(int32 entryIndex, API_PARAM(Ref) const Ray& ray, API_PARAM(Out) float& distance, API_PARAM(Out) Vector3& normal) = 0;
|
||||
API_FUNCTION() virtual bool IntersectsEntry(int32 entryIndex, API_PARAM(Ref) const Ray& ray, API_PARAM(Out) float& distance, API_PARAM(Out) Vector3& normal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the model actor mesh entry and a ray.
|
||||
@@ -76,7 +74,10 @@ public:
|
||||
/// <param name="normal">When the method completes, contains the intersection surface normal vector (if any valid).</param>
|
||||
/// <param name="entryIndex">When the method completes, contains the intersection entry index (if any valid).</param>
|
||||
/// <returns>True if the actor is intersected by the ray, otherwise false.</returns>
|
||||
API_FUNCTION() virtual bool IntersectsEntry(API_PARAM(Ref) const Ray& ray, API_PARAM(Out) float& distance, API_PARAM(Out) Vector3& normal, API_PARAM(Out) int32& entryIndex) = 0;
|
||||
API_FUNCTION() virtual bool IntersectsEntry(API_PARAM(Ref) const Ray& ray, API_PARAM(Out) float& distance, API_PARAM(Out) Vector3& normal, API_PARAM(Out) int32& entryIndex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -181,6 +181,7 @@ private:
|
||||
|
||||
void OnModelChanged();
|
||||
void OnModelLoaded();
|
||||
void UpdateBounds();
|
||||
|
||||
public:
|
||||
|
||||
@@ -193,7 +194,6 @@ public:
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
bool IntersectsEntry(int32 entryIndex, const Ray& ray, float& distance, Vector3& normal) override;
|
||||
bool IntersectsEntry(const Ray& ray, float& distance, Vector3& normal, int32& entryIndex) override;
|
||||
void UpdateBounds() override;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user