public SerializableModel(Node node, TimeValue t, bool bMeshData, bool bReferencedData) { color = node.Color; bone = node.IsBone; if (bMeshData) // && node.Visibility.Render) mesh = node.GetMesh(t); transform = node.GetNodeTransform(t); name = node.Name; foreach (Node child in node.Nodes) models.Add(new SerializableModel(child, t, bMeshData)); if (bReferencedData) foreach (SceneObject obj in node.TargetTree.FilterType<SceneObject>()) submeshes.Add(obj.GetMesh(t)); }
// Operator overload - Matrix Mult public static Matrix3 operator*(Matrix3 lhs, Matrix3 rhs) { Matrix3 res = new Matrix3(); res[0][0] = lhs[0][0] * rhs[0][0] + lhs[0][1] * rhs[1][0] + lhs[0][2] * rhs[2][0]; res[0][1] = lhs[0][0] * rhs[0][1] + lhs[0][1] * rhs[1][1] + lhs[0][2] * rhs[2][1]; res[0][2] = lhs[0][0] * rhs[0][2] + lhs[0][1] * rhs[1][2] + lhs[0][2] * rhs[2][2]; res[1][0] = lhs[1][0] * rhs[0][0] + lhs[1][1] * rhs[1][0] + lhs[1][2] * rhs[2][0]; res[1][1] = lhs[1][0] * rhs[0][1] + lhs[1][1] * rhs[1][1] + lhs[1][2] * rhs[2][1]; res[1][2] = lhs[1][0] * rhs[0][2] + lhs[1][1] * rhs[1][2] + lhs[1][2] * rhs[2][2]; res[2][0] = lhs[2][0] * rhs[0][0] + lhs[2][1] * rhs[1][0] + lhs[2][2] * rhs[2][0]; res[2][1] = lhs[2][0] * rhs[0][1] + lhs[2][1] * rhs[1][1] + lhs[2][2] * rhs[2][1]; res[2][2] = lhs[2][0] * rhs[0][2] + lhs[2][1] * rhs[1][2] + lhs[2][2] * rhs[2][2]; res[3][0] = lhs[3][0] * rhs[0][0] + lhs[3][1] * rhs[1][0] + lhs[3][2] * rhs[2][0] + rhs[3][0]; res[3][1] = lhs[3][0] * rhs[0][1] + lhs[3][1] * rhs[1][1] + lhs[3][2] * rhs[2][1] + rhs[3][1]; res[3][2] = lhs[3][0] * rhs[0][2] + lhs[3][1] * rhs[1][2] + lhs[3][2] * rhs[2][2] + rhs[3][2]; return res; }
public void SetNodeTransform(Matrix3 m, TimeValue t) { _Node.SetNodeTM(t, m._IMatrix3); }
public Matrix3 GetObjectTransform(TimeValue t, out Interval validity) { IInterval v = Kernel._Global.Interval.Create(); Matrix3 r = new Matrix3(_Node.GetObjectTM(t, v)); validity = new Interval(v); return r; }
public void SetNodeTransform(Matrix3 m, TimeValue t) { _Node.SetNodeTM(t, m._IMatrix3); }
public Node(MaxSharp.Node n) : base(n) { name = n.Name; if (n.Object != null) sceneobject = new Reference(n.Object.Base); else sceneobject = new Reference(); transform = n.NodeTransform; nodes = (from x in n.Nodes select new Node(x)).ToArray(); modifiers = (from x in n.Modifiers select new Reference(x)).ToArray(); }