private void Integrate() { var OldTransform = BuiltTransform; var OldAccumulated = Accumulated; BuiltTransform = Local; if (0 != Depth) { BuiltTransform *= Outer.BuiltTransform; Accumulated = Outer.Accumulated; Accumulated.translation.X += Mult(Accumulated.scale, Local.translation.X); Accumulated.translation.Y += Mult(Accumulated.scale, Local.translation.Y); Accumulated.translation.Z += Mult(Accumulated.scale, Local.translation.Z); Accumulated.scale *= Local.scale; Accumulated.rotation += Local.rotation; //BuiltTransform = Accumulated; } LocalCached = Local; ExplicitlyDirty = false; // when the transform actually changed all immediate children need to be marked explicitly. if (OldTransform != BuiltTransform || OldAccumulated != Accumulated) { GeoNode Current; uint Pos; for (Pos = NumImmediate, Current = LastChild; 0 != Pos; Current = Current.Sibling, --Pos) { Current.ExplicitlyDirty = true; } } }
public GeoNode(GeoParent Parent) : base(EnsureParentGetRoot(Parent)) { this.BuiltTransform = Transform.Identity; this.Local = TransformI.Identity; this.LocalCached = TransformI.Identity; this.Outer = (Root == Parent) ? this : (GeoNode)Parent; this.Depth = this.Outer == this ? 0u : (this.Outer.Depth + 1u); if (0 == this.Root.Num++) { this.Next = this; } else { this.Next = this.Root.Last.Next; this.Root.Last.Next = this; } this.Root.Last = this; if (0 == (this.ChildIndex = Parent.NumImmediate++)) { this.Sibling = this; } else { this.Sibling = Parent.LastChild.Sibling; Parent.LastChild.Sibling = this; } Parent.LastChild = this; this.ID = this.Root.IDCounter++; this.ExplicitlyDirty = 0 != Depth; }
public void BuildTransform(out TransformI Transform, bool SkipCheck = false) { if (!SkipCheck) { Update(); } Transform = Accumulated; }