Remove motion lerper. Reconstruct RMV and motion node. Add motion node pool.
This commit is contained in:
@@ -153,8 +153,8 @@ namespace Cryville.Crtr {
|
|||||||
bbus.ForwardByTime(dt);
|
bbus.ForwardByTime(dt);
|
||||||
UnityEngine.Profiling.Profiler.BeginSample("ChartPlayer.Forward");
|
UnityEngine.Profiling.Profiler.BeginSample("ChartPlayer.Forward");
|
||||||
UnityEngine.Profiling.Profiler.BeginSample("EventBus.Copy");
|
UnityEngine.Profiling.Profiler.BeginSample("EventBus.Copy");
|
||||||
bbus.CopyTo(2, tbus);
|
bbus.CopyTo(tbus);
|
||||||
bbus.CopyTo(3, nbus);
|
bbus.CopyTo(nbus);
|
||||||
UnityEngine.Profiling.Profiler.EndSample();
|
UnityEngine.Profiling.Profiler.EndSample();
|
||||||
actualRenderStep = step;
|
actualRenderStep = step;
|
||||||
|
|
||||||
@@ -250,11 +250,12 @@ namespace Cryville.Crtr {
|
|||||||
UnityEngine.Profiling.Profiler.GetTotalReservedMemory()
|
UnityEngine.Profiling.Profiler.GetTotalReservedMemory()
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
if (ContainerState.RMVPool != null) {
|
if (RMVPool.Shared != null) {
|
||||||
statusbuf.AppendFormat(
|
statusbuf.AppendFormat(
|
||||||
"\nPools: RMV {0}, MC {1}",
|
"\nPools: RMV {0}, MC {1}, MN {2}",
|
||||||
RMVPool.Shared.RentedCount,
|
RMVPool.Shared.RentedCount,
|
||||||
MotionCachePool.Shared.RentedCount
|
MotionCachePool.Shared.RentedCount,
|
||||||
|
MotionNodePool.Shared.RentedCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (loadThread != null) {
|
if (loadThread != null) {
|
||||||
@@ -673,6 +674,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
RMVPool.Shared = new RMVPool();
|
RMVPool.Shared = new RMVPool();
|
||||||
MotionCachePool.Shared = new MotionCachePool();
|
MotionCachePool.Shared = new MotionCachePool();
|
||||||
|
MotionNodePool.Shared = new MotionNodePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSkin(FileInfo file) {
|
void LoadSkin(FileInfo file) {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
//#define DISABLE_CACHE
|
|
||||||
|
|
||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
using Cryville.Common.Buffers;
|
using Cryville.Common.Buffers;
|
||||||
using Cryville.Common.Collections.Specialized;
|
using Cryville.Common.Collections.Specialized;
|
||||||
@@ -248,32 +246,26 @@ namespace Cryville.Crtr.Event {
|
|||||||
Children[c].InvalidateMotion(name);
|
Children[c].InvalidateMotion(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector GetRawValue(int key) {
|
public Vector GetComputedValue(int key) {
|
||||||
MotionCache tr;
|
MotionCache tr;
|
||||||
if (!CachedValues.TryGetValue(key, out tr))
|
if (!CachedValues.TryGetValue(key, out tr))
|
||||||
CachedValues.Add(key, tr = _mcpa.Rent(key));
|
CachedValues.Add(key, tr = _mcpa.Rent(key));
|
||||||
Vector r = tr.Value;
|
Vector r = tr.Value;
|
||||||
#if !DISABLE_CACHE
|
|
||||||
if (tr.Valid) return r;
|
if (tr.Valid) return r;
|
||||||
#endif
|
GetMotionValue(key).Compute(ref r);
|
||||||
float reltime = 0;
|
if (Parent != null) r.ApplyFrom(Parent.GetComputedValue(key));
|
||||||
if (rootPrototype != null) reltime = (float)(Time - rootPrototype.Time);
|
|
||||||
GetMotionValue(key).GetValue(reltime, ref r);
|
|
||||||
if (Parent != null) r.ApplyFrom(Parent.GetRawValue(key));
|
|
||||||
#if !DISABLE_CACHE
|
|
||||||
tr.Valid = true;
|
tr.Valid = true;
|
||||||
#endif
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetRawValue<T>(int key) where T : Vector {
|
public T GetComputedValue<T>(int key) where T : Vector {
|
||||||
return (T)GetRawValue(key);
|
return (T)GetComputedValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly int n_pt = IdentifierManager.SharedInstance.Request("pt");
|
static readonly int n_pt = IdentifierManager.SharedInstance.Request("pt");
|
||||||
public Vector2 ScreenPoint {
|
public Vector2 ScreenPoint {
|
||||||
get {
|
get {
|
||||||
var mv = GetRawValue<Vec2>(n_pt);
|
var mv = GetComputedValue<Vec2>(n_pt);
|
||||||
return mv.ToVector2();
|
return mv.ToVector2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,7 +273,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
static readonly int n_dir = IdentifierManager.SharedInstance.Request("dir");
|
static readonly int n_dir = IdentifierManager.SharedInstance.Request("dir");
|
||||||
public Vector3 Direction {
|
public Vector3 Direction {
|
||||||
get {
|
get {
|
||||||
Vec3 r = GetRawValue<Vec3>(n_dir);
|
Vec3 r = GetComputedValue<Vec3>(n_dir);
|
||||||
return r.ToVector3();
|
return r.ToVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +281,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
static readonly int n_normal = IdentifierManager.SharedInstance.Request("normal");
|
static readonly int n_normal = IdentifierManager.SharedInstance.Request("normal");
|
||||||
public Vector3 Normal {
|
public Vector3 Normal {
|
||||||
get {
|
get {
|
||||||
Vec3 r = GetRawValue<Vec3>(n_normal);
|
Vec3 r = GetComputedValue<Vec3>(n_normal);
|
||||||
return r.ToVector3();
|
return r.ToVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,21 +296,21 @@ namespace Cryville.Crtr.Event {
|
|||||||
static readonly int n_svm = IdentifierManager.SharedInstance.Request("svm");
|
static readonly int n_svm = IdentifierManager.SharedInstance.Request("svm");
|
||||||
public float ScrollVelocity {
|
public float ScrollVelocity {
|
||||||
get {
|
get {
|
||||||
return GetRawValue<Vec1>(n_sv).Value * GetRawValue<Vec1m>(n_svm).Value;
|
return GetComputedValue<Vec1>(n_sv).Value * GetComputedValue<Vec1m>(n_svm).Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly int n_dist = IdentifierManager.SharedInstance.Request("dist");
|
static readonly int n_dist = IdentifierManager.SharedInstance.Request("dist");
|
||||||
public float Distance {
|
public float Distance {
|
||||||
get {
|
get {
|
||||||
return GetRawValue<Vec1>(n_dist).Value;
|
return GetComputedValue<Vec1>(n_dist).Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly int n_track = IdentifierManager.SharedInstance.Request("track");
|
static readonly int n_track = IdentifierManager.SharedInstance.Request("track");
|
||||||
public float Track {
|
public float Track {
|
||||||
get {
|
get {
|
||||||
return GetRawValue<Vec1>(n_track).Value;
|
return GetComputedValue<Vec1>(n_track).Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -403,7 +395,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var scaledTime = (float)((Time - m.Key.Time - ChartPlayer.actualRenderStep * tev.sumfix) / m.Key.Duration);
|
var scaledTime = (float)((Time - m.Key.Time - ChartPlayer.actualRenderStep * tev.sumfix) / m.Key.Duration);
|
||||||
var lerpedTime = MotionLerper.GetEaseTime(scaledTime, TransitionType.Ease, 1);
|
|
||||||
if (tev.Node.Id >= 0) {
|
if (tev.Node.Id >= 0) {
|
||||||
var start = m.Value.GetRelativeNode(tev.Node.Id);
|
var start = m.Value.GetRelativeNode(tev.Node.Id);
|
||||||
if (start == null) {
|
if (start == null) {
|
||||||
@@ -412,11 +403,12 @@ namespace Cryville.Crtr.Event {
|
|||||||
else {
|
else {
|
||||||
var target = value.GetRelativeNode(tev.Node.Id);
|
var target = value.GetRelativeNode(tev.Node.Id);
|
||||||
if (target == null) value.SetRelativeNode(tev.Node);
|
if (target == null) value.SetRelativeNode(tev.Node);
|
||||||
else tev.Node.LerpWith(m.Value.GetRelativeNode(tev.Node.Id), lerpedTime, ref target);
|
else tev.Node.LerpWith(m.Value.GetRelativeNode(tev.Node.Id), scaledTime, ref target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tev.Node.Value.LerpWith(m.Value.AbsoluteValue, lerpedTime, ref value.AbsoluteValue);
|
tev.Node.Value.LerpWith(m.Value.AbsoluteValue, scaledTime, ref value.AbsoluteValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user