public static void camera_set_matrix(uint clientId, uint sceneId, Transform t) { cycles_camera_set_matrix(clientId, sceneId, t.x.x, t.x.y, t.x.z, t.x.w, t.y.x, t.y.y, t.y.z, t.y.w, t.z.x, t.z.y, t.z.z, t.z.w, t.w.x, t.w.y, t.w.z, t.w.w); }
public static void object_set_matrix(uint clientId, uint sceneId, uint objectId, Transform t) { cycles_scene_object_set_matrix(clientId, sceneId, objectId, t.x.x, t.x.y, t.x.z, t.x.w, t.y.x, t.y.y, t.y.z, t.y.w, t.z.x, t.z.y, t.z.z, t.z.w, t.w.x, t.w.y, t.w.z, t.w.w); }
public XmlReadState(Scene scene, Transform transform, bool smooth, Shader shader, string basePath, float dicingRate, bool silent) { Scene = scene; Transform = transform; Smooth = smooth; Shader = shader; BasePath = basePath; DicingRate = dicingRate; Silent = silent; }
/// <summary> /// Give transposed matrix of a /// </summary> /// <param name="a"></param> /// <returns></returns> public static Transform Transpose(Transform a) { var t = new Transform { x = {x = a.x.x, y = a.y.x, z = a.z.x, w = a.w.x}, y = {x = a.x.y, y = a.y.y, z = a.z.y, w = a.w.y}, z = {x = a.x.z, y = a.y.z, z = a.z.z, w = a.w.z}, w = {x = a.x.w, y = a.y.w, z = a.z.w, w = a.w.w} }; return t; }
/// <summary> /// Copy constructor /// </summary> /// <param name="old"></param> public Transform(Transform old) : this(old.x.x, old.x.y, old.x.z, old.x.w, old.y.x, old.y.y, old.y.z, old.y.w, old.z.x, old.z.y, old.z.z, old.z.w, old.w.x, old.w.y, old.w.z, old.w.w) { }
/// <summary> /// Constructor /// </summary> /// <param name="id">Id of object</param> /// <param name="t">Transform</param> public CyclesObjectTransform(uint id, Transform t) { Id = id; Transform = t; }
/// <summary> /// Get a transform from given float string /// </summary> /// <param name="transform">Transform to create new transform in</param> /// <param name="mat">string with 16 floats</param> /// <returns>true if a parsing was possible</returns> public bool get_transform(Transform transform, string mat) { if (string.IsNullOrWhiteSpace(mat)) return false; var matrix = parse_floats(mat); if (matrix.Length != 16) return false; transform.SetMatrix(matrix); return true; }
public void CopyTo(Transform target) { target.x.x = x.x; target.x.y = x.y; target.x.z = x.z; target.x.w = x.w; target.y.x = y.x; target.y.y = y.y; target.y.z = y.z; target.y.w = y.w; target.z.x = z.x; target.z.y = z.y; target.z.z = z.z; target.z.w = z.w; target.w.x = w.x; target.w.y = w.y; target.w.z = w.z; target.w.w = w.w; }
public void CopyFrom(Transform source) { x.x = source.x.x; x.y = source.x.y; x.z = source.x.z; x.w = source.x.w; y.x = source.y.x; y.y = source.y.y; y.z = source.y.z; y.w = source.y.w; z.x = source.z.x; z.y = source.z.y; z.z = source.z.z; z.w = source.z.w; w.x = source.w.x; w.y = source.w.y; w.z = source.w.z; w.w = source.w.w; }
/// <summary> /// Read a transform from XML. /// /// If all are available then they are read and applied to transform according formula: /// /// transform = ((matrix * translate) * rotate) * scale /// </summary> /// <param name="node"></param> /// <param name="transform"></param> private void ReadTransform(System.Xml.XmlReader node, ref Transform transform) { var mat = node.GetAttribute("matrix"); var f4 = new float4(0.0f); var t = new Transform(); if (Utilities.Instance.get_transform(t, mat)) transform = t; var trans = node.GetAttribute("translate"); if (Utilities.Instance.get_float4(f4, trans)) transform = transform*Transform.Translate(f4); var rotate = node.GetAttribute("rotate"); if (Utilities.Instance.get_float4(f4, rotate)) { var a = DegToRad(f4[0]); var axis = new float4(f4[1], f4[2], f4[3]); transform = transform*ccl.Transform.Rotate(a, axis); } var scale = node.GetAttribute("scale"); if (!string.IsNullOrEmpty(scale)) { var components = Utilities.Instance.parse_floats(scale); if(components.Length == 3) { transform = transform*ccl.Transform.Scale(components[0], components[1], components[2]); } } }