Name PathCamera property fields

This commit is contained in:
Jack Andersen 2018-06-25 19:42:16 -10:00
parent 68504f5c3a
commit f8b8211b0f
6 changed files with 42 additions and 38 deletions

View File

@ -14,25 +14,25 @@ struct PathCamera : IScriptObject
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<bool> active;
struct CameraParameters : BigDNA
{
AT_DECL_DNA
Value<atUint32> propertyCount;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
Value<bool> unknown6;
Value<bool> closedLoop;
Value<bool> noFilter;
Value<bool> tangentOrientation;
Value<bool> easeDist;
Value<bool> useHintLookZ;
Value<bool> clampToClosedDoor;
} cameraParameters;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<atUint32> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> lengthExtent;
Value<float> filterMag;
Value<float> filterProportion;
Value<atUint32> initPos;
Value<float> minEaseDist;
Value<float> maxEaseDist;
};
}

View File

@ -5,7 +5,7 @@
namespace urde
{
CCameraSpline::CCameraSpline(bool b) : x48_closedLoop(b) {}
CCameraSpline::CCameraSpline(bool closedLoop) : x48_closedLoop(closedLoop) {}
void CCameraSpline::CalculateKnots(TUniqueId cameraId, const std::vector<SConnection>& connections, CStateManager& mgr)
{

View File

@ -21,7 +21,7 @@ class CCameraSpline
bool GetSurroundingPoints(int idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
rstl::reserved_vector<zeus::CVector3f, 4>& directions) const;
public:
CCameraSpline(bool);
CCameraSpline(bool closedLoop);
void CalculateKnots(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Initialize(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Reset(int size);

View File

@ -12,15 +12,17 @@ namespace urde
{
CPathCamera::CPathCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float f1, float f2,
float f3, float f4, float f5, u32 flags, EInitialSplinePosition initPos)
const zeus::CTransform& xf, bool active, float lengthExtent, float filterMag,
float filterProportion, float minEaseDist, float maxEaseDist, u32 flags,
EInitialSplinePosition initPos)
: CGameCamera(uid, active, name, info, xf,
CCameraManager::ThirdPersonFOV(),
CCameraManager::NearPlane(),
CCameraManager::FarPlane(),
CCameraManager::Aspect(), kInvalidUniqueId, 0, 0)
, x188_spline(flags & 1), x1dc_lengthExtent(f1), x1e0_(f2), x1e4_(f3), x1e8_initPos(initPos)
, x1ec_flags(flags), x1f0_(f4), x1f4_(f5)
, x188_spline(flags & 1), x1dc_lengthExtent(lengthExtent), x1e0_filterMag(filterMag)
, x1e4_filterProportion(filterProportion), x1e8_initPos(initPos), x1ec_flags(flags)
, x1f0_minEaseDist(minEaseDist), x1f4_maxEaseDist(maxEaseDist)
{
}
@ -168,7 +170,8 @@ zeus::CTransform CPathCamera::MoveAlongSpline(float t, CStateManager& mgr)
float distToPlayer = 0.f;
if (splineToPlayer.canBeNormalized())
distToPlayer = splineToPlayer.magnitude();
f30 *= 1.f - std::sin(zeus::degToRad(zeus::clamp(0.f, (distToPlayer - x1f0_) / (x1f4_ - x1f0_), 1.f) * 90.f));
f30 *= 1.f - std::sin(zeus::degToRad(zeus::clamp(0.f, (distToPlayer - x1f0_minEaseDist) /
(x1f4_maxEaseDist - x1f0_minEaseDist), 1.f) * 90.f));
}
float newPos;
@ -207,9 +210,8 @@ zeus::CTransform CPathCamera::MoveAlongSpline(float t, CStateManager& mgr)
if (x188_spline.IsClosedLoop())
{
float absDelta = std::fabs(newPos - x1d4_pos);
if (absDelta > x188_spline.GetLength() - absDelta)
absDelta = x188_spline.GetLength() - absDelta;
float tBias = zeus::clamp(-1.f, absDelta / x1e4_, 1.f) * x1e0_ * t;
absDelta = std::min(absDelta, x188_spline.GetLength() - absDelta);
float tBias = zeus::clamp(-1.f, absDelta / x1e4_filterProportion, 1.f) * x1e0_filterMag * t;
float tmpAbs = std::fabs(x1d4_pos - newPos);
float absDelta2 = x188_spline.GetLength() - tmpAbs;
if (x1d4_pos > newPos)
@ -227,7 +229,7 @@ zeus::CTransform CPathCamera::MoveAlongSpline(float t, CStateManager& mgr)
else
{
x1d4_pos = x188_spline.ValidateLength(
zeus::clamp(-1.f, (newPos - x1d4_pos) / x1e4_, 1.f) * x1e0_ * t + x1d4_pos);
zeus::clamp(-1.f, (newPos - x1d4_pos) / x1e4_filterProportion, 1.f) * x1e0_filterMag * t + x1d4_pos);
}
ret = x188_spline.GetInterpolatedSplinePointByLength(x1d4_pos);
}

View File

@ -23,17 +23,18 @@ private:
float x1d4_pos = 0.f;
float x1d8_time = 0.f;
float x1dc_lengthExtent;
float x1e0_;
float x1e4_;
float x1e0_filterMag;
float x1e4_filterProportion;
EInitialSplinePosition x1e8_initPos;
u32 x1ec_flags;
float x1f0_;
float x1f4_;
float x1f0_minEaseDist;
float x1f4_maxEaseDist;
public:
CPathCamera(TUniqueId, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool, float, float, float,
float, float, u32, EInitialSplinePosition);
CPathCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float lengthExtent, float filterMag,
float filterProportion, float minEaseDist, float maxEaseDist, u32 flags,
EInitialSplinePosition initPos);
void Accept(IVisitor&);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);

View File

@ -1452,14 +1452,15 @@ CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int
SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool();
u32 flags = LoadParameterFlags(in);
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
float lengthExtent = in.readFloatBig();
float filterMag = in.readFloatBig();
float filterProportion = in.readFloatBig();
CPathCamera::EInitialSplinePosition initPos = CPathCamera::EInitialSplinePosition(in.readUint32Big());
float f4 = in.readFloatBig();
float f5 = in.readFloatBig();
return new CPathCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, f1, f2, f3, f4, f5,
flags, initPos);
float minEaseDist = in.readFloatBig();
float maxEaseDist = in.readFloatBig();
return new CPathCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, lengthExtent,
filterMag, filterProportion, minEaseDist, maxEaseDist, flags, initPos);
}
CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)