public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); values.Vector.I = X; values.Vector.J = Y; values.Vector.K = Z; }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Math.real_quaternion temp = new LowLevel.Math.real_quaternion(); temp.W = values.W; // A temp.Vector.I = values.Vector.K; // B temp.Vector.J = values.Vector.J; // G temp.Vector.K = values.Vector.I; // R LowLevel.Xna.Math.ConvertColor(temp, out Value); }
public ColladaBoneMatrix(string name, LowLevel.Math.real_point3d translation, LowLevel.Math.real_quaternion rotation, float scale) { Name = name; translationVector = new SlimDX.Vector3(translation.X, translation.Y, translation.Z); rotationQuaternion = new SlimDX.Quaternion(rotation.Vector.I, rotation.Vector.J, rotation.Vector.K, rotation.W); scaleAmount = scale; }
// TODO: Have each engine's VBI's Definition have a bit-vector which maps with a // string list with all possible Element names on that engine. Could enable faster // and more complex Element querying later on /// <summary> /// Get an element streamed from a buffer by its element name (ie, /// <see cref="kTypePosition"/>) /// </summary> /// <param name="element_type_name"></param> /// <param name="value"></param> /// <returns></returns> public bool FindStreamedElement(string element_type_name, ref LowLevel.Math.real_quaternion value) { int se_index = Array.FindIndex(elements, e => e.GetTypeBase().Name == element_type_name); if (se_index != -1) { value = streamedElements[se_index]; } return(se_index != -1); }
/// <summary> /// <see cref="LowLevel.Math.real_vector3d.I"/> = R, /// <see cref="LowLevel.Math.real_vector3d.J"/> = G, /// <see cref="LowLevel.Math.real_vector3d.K"/> = B, /// <see cref="LowLevel.Math.real_quaternion.W"/> = A /// </summary> /// <param name="values"></param> public void Denormalize(out LowLevel.Math.real_quaternion values) { LowLevel.Math.real_quaternion temp = LowLevel.Xna.Math.ConvertColor(Value); // I\X = B // J\Y = G // K\Z = R // W\W = A values = new LowLevel.Math.real_quaternion(); values.Vector.I = temp.Vector.K; // R values.Vector.J = temp.Vector.J; // G values.Vector.K = temp.Vector.I; // B values.W = temp.W; // A }
void ReconstructRawPca(int pca_data_offset, int stream_source, Render.VertexBufferInterface.StreamReader stream_reader) { LowLevel.Math.real_quaternion quat = new LowLevel.Math.real_quaternion(); if (stream_reader.FindStreamedElement(Render.VertexBufferInterface.VertexBuffersGen2.kTypePcaClusterId, ref quat)) { RawPcaData[(pca_data_offset * 5) + 0].RawPcaData.Value = quat.Vector.I; } if (stream_reader.FindStreamedElement(Render.VertexBufferInterface.VertexBuffersGen2.kTypePcaVertexWeights, ref quat)) { RawPcaData[(pca_data_offset * 5) + 1].RawPcaData.Value = quat.Vector.I; RawPcaData[(pca_data_offset * 5) + 2].RawPcaData.Value = quat.Vector.J; RawPcaData[(pca_data_offset * 5) + 3].RawPcaData.Value = quat.Vector.K; RawPcaData[(pca_data_offset * 5) + 4].RawPcaData.Value = quat.W; } }
void ReconstructRawVertex(lightmap_vertex_buffer_bucket_block buffer_bucket, int stream_source, Render.VertexBufferInterface.StreamReader stream_reader) { LowLevel.Math.real_quaternion quat = new LowLevel.Math.real_quaternion(); // The following LM vertex sources only have one element, so we can call this here stream_reader.GetStreamedElement(0, ref quat); if (buffer_bucket.Flags.Test(k_bucket_flags_IncDir) && stream_source == 0) { PrimaryLightmapIncidentDirection.I = quat.Vector.I; PrimaryLightmapIncidentDirection.J = quat.Vector.J; PrimaryLightmapIncidentDirection.K = quat.Vector.K; } else if (buffer_bucket.Flags.Test(k_bucket_flags_Color) && stream_source == 1) { // alpha is quad.W, which LM color doesn't use PrimaryLightmapColor.R = quat.Vector.I; PrimaryLightmapColor.G = quat.Vector.J; PrimaryLightmapColor.B = quat.Vector.K; } }
public void Normalize(LowLevel.Math.real_quaternion values) { }
/// <summary> /// Returns a quaternion with an inverted vector /// </summary> /// <param name="quaternion">The quaternion to invert</param> /// <returns></returns> public static LowLevel.Math.real_quaternion Invert(LowLevel.Math.real_quaternion quaternion) { LowLevel.Math.real_quaternion quat_out = new LowLevel.Math.real_quaternion(); quat_out.Vector.I = -quaternion.Vector.I; quat_out.Vector.J = -quaternion.Vector.J; quat_out.Vector.K = -quaternion.Vector.K; quat_out.W = quaternion.W; return quat_out; }
/// <summary> /// <see cref="LowLevel.Math.real_vector3d.I"/> = R, /// <see cref="LowLevel.Math.real_vector3d.J"/> = G, /// <see cref="LowLevel.Math.real_vector3d.K"/> = B, /// <see cref="LowLevel.Math.real_quaternion.W"/> = A /// </summary> /// <param name="values"></param> public void Denormalize(out LowLevel.Math.real_quaternion values) { LowLevel.Math.real_quaternion temp = LowLevel.Xna.Math.ConvertColor(Value); // I\X = B // J\Y = G // K\Z = R // W\W = A values = new LowLevel.Math.real_quaternion(); values.Vector.I = temp.Vector.K; // R values.Vector.J = temp.Vector.J; // G values.Vector.K = temp.Vector.I; // B values.W = temp.W; // A }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertByte4N(Value); }
public static string ToString(LowLevel.Math.real_quaternion values) { return(string.Format("[Byte4N {0}\t{1}\t{2}\t{3}]", values.Vector.I.ToString(), values.Vector.J.ToString(), values.Vector.K.ToString(), values.W.ToString())); }
void ReconstructRawVertex(global_geometry_section_info_struct section_info, int stream_source, BlamLib.Render.VertexBufferInterface.StreamReader stream_reader) { LowLevel.Math.real_quaternion quat = new LowLevel.Math.real_quaternion(); if (stream_source == 0) { if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypePosition, ref quat)) { Point.Position.X = quat.Vector.I; Point.Position.Y = quat.Vector.J; Point.Position.Z = quat.Vector.K; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeNodeIndices, ref quat)) { Point.NodeIndex[0].Value = ((int)quat.Vector.I) - 1; Point.NodeIndex[1].Value = ((int)quat.Vector.J) - 1; Point.NodeIndex[2].Value = ((int)quat.Vector.K) - 1; Point.NodeIndex[3].Value = ((int)quat.W) - 1; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeNodeWeights, ref quat)) { Point.NodeWeight[0].Value = quat.Vector.I; Point.NodeWeight[1].Value = quat.Vector.J; Point.NodeWeight[2].Value = quat.Vector.K; Point.NodeWeight[3].Value = quat.W; } } else if (stream_source == 1) { if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeTexCoord, ref quat)) { Texcoord.X = quat.Vector.I; Texcoord.Y = quat.Vector.J; } } else if (stream_source == 2) { if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeNormal, ref quat)) { Normal.I = quat.Vector.I; Normal.J = quat.Vector.J; Normal.K = quat.Vector.K; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeBinormal, ref quat)) { Binormal.I = quat.Vector.I; Binormal.J = quat.Vector.J; Binormal.K = quat.Vector.K; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeTangent, ref quat)) { Tangent.I = quat.Vector.I; Tangent.J = quat.Vector.J; Tangent.K = quat.Vector.K; } } if (section_info != null && stream_source > 2) { int x = 2; // The following LM vertex sources only have one element, so we can call this here stream_reader.GetStreamedElement(0, ref quat); if (section_info.SectionLightingFlags.Test(k_lighting_flags_HasLmTexCoords) && stream_source == ++x) { PrimaryLightmapTexcoord.X = quat.Vector.I; PrimaryLightmapTexcoord.Y = quat.Vector.J; } else if (section_info.SectionLightingFlags.Test(k_lighting_flags_HasLmIncRad) && stream_source == ++x) { PrimaryLightmapIncidentDirection.I = quat.Vector.I; PrimaryLightmapIncidentDirection.J = quat.Vector.J; PrimaryLightmapIncidentDirection.K = quat.Vector.K; } else if (section_info.SectionLightingFlags.Test(k_lighting_flags_HasLmColor) && stream_source == ++x) { // alpha is quad.W, which LM color doesn't use PrimaryLightmapColor.R = quat.Vector.I; PrimaryLightmapColor.G = quat.Vector.J; PrimaryLightmapColor.B = quat.Vector.K; } } #region Unused vertex elements // if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.VertexBuffersHalo2.kTypeAnisoBinormal, // ref quat)) // { // AnisotropicBinormal.I = quat.Vector.I; // AnisotropicBinormal.J = quat.Vector.J; // AnisotropicBinormal.K = quat.Vector.K; // } // // if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.VertexBuffersHalo2.kTypeSecondaryTexCoord, // ref quat)) // { // SecondaryTexcoord.X = quat.Vector.I; // SecondaryTexcoord.Y = quat.Vector.J; // } #endregion }
public static string ToString(LowLevel.Math.real_quaternion values) { return(string.Format("[UShort2N {0}\t{1}]", values.Vector.I.ToString(), values.Vector.J.ToString())); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertUShort4N(X, Y, Z, W); }
public static DX.Vector4 To4D(this LowLevel.Math.real_quaternion values) { return(new DX.Vector4(values.Vector.I, values.Vector.J, values.Vector.K, values.W)); }
public static DX.Vector3 To3D(this LowLevel.Math.real_quaternion values) { return(new DX.Vector3(values.Vector.I, values.Vector.J, values.Vector.K)); }
public static DX.Vector2 To2D(this LowLevel.Math.real_quaternion values) { return(new DX.Vector2(values.Vector.I, values.Vector.J)); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); values.Vector.I = (float)X; values.Vector.J = (float)Y; values.Vector.K = (float)Z; }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); values.Vector.I = X; }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertFloat16Four(X, Y, Z, W); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertDec3N(Value); //values = new LowLevel.Math.real_quaternion(); }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertUShort4N(values, out X, out Y, out Z, out W); }
void ReconstructRawPca(int pca_data_offset, int stream_source, Render.VertexBufferInterface.StreamReader stream_reader) { LowLevel.Math.real_quaternion quat = new LowLevel.Math.real_quaternion(); if(stream_reader.FindStreamedElement(Render.VertexBufferInterface.VertexBuffersGen2.kTypePcaClusterId, ref quat)) { RawPcaData[(pca_data_offset*5)+0].RawPcaData.Value = quat.Vector.I; } if (stream_reader.FindStreamedElement(Render.VertexBufferInterface.VertexBuffersGen2.kTypePcaVertexWeights, ref quat)) { RawPcaData[(pca_data_offset*5)+1].RawPcaData.Value = quat.Vector.I; RawPcaData[(pca_data_offset*5)+2].RawPcaData.Value = quat.Vector.J; RawPcaData[(pca_data_offset*5)+3].RawPcaData.Value = quat.Vector.K; RawPcaData[(pca_data_offset*5)+4].RawPcaData.Value = quat.W; } }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertFloat16Four(values, out X, out Y, out Z, out W); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); values.Vector.I = (float)X; values.Vector.J = (float)Y; }
public static string ToString(LowLevel.Math.real_quaternion values) { return(string.Format("[Float1 {0}]", values.Vector.I.ToString())); }
public void Normalize(LowLevel.Math.real_quaternion values) { X = (byte)values.Vector.I; Y = (byte)values.Vector.J; Z = (byte)values.Vector.K; }
public void Normalize(LowLevel.Math.real_quaternion values) { X = values.Vector.I; }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertShort2(values, out X, out Y); }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertByte4N(values, out Value); }
public static string ToString(LowLevel.Math.real_quaternion values) { return(string.Format("[UbyteN {0}\t0\t0\t0]", values.Vector.I.ToString() /*, values.Vector.J.ToString(), values.Vector.K.ToString(), values.W.ToString()*/)); }
string IDeclType.ToString(LowLevel.Math.real_quaternion values) { return(ToString(values)); }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Math.real_quaternion temp = new LowLevel.Math.real_quaternion(); temp.W = values.W; // A temp.Vector.I = values.Vector.K; // B temp.Vector.J = values.Vector.J; // G temp.Vector.K = values.Vector.I; // R LowLevel.Xna.Math.ConvertColor(temp, out Value); }
void ReconstructRawVertex(lightmap_vertex_buffer_bucket_block buffer_bucket, int stream_source, Render.VertexBufferInterface.StreamReader stream_reader) { LowLevel.Math.real_quaternion quat = new LowLevel.Math.real_quaternion(); // The following LM vertex sources only have one element, so we can call this here stream_reader.GetStreamedElement(0, ref quat); if (buffer_bucket.Flags.Test(k_bucket_flags_IncDir) && stream_source == 0) { PrimaryLightmapIncidentDirection.I = quat.Vector.I; PrimaryLightmapIncidentDirection.J = quat.Vector.J; PrimaryLightmapIncidentDirection.K = quat.Vector.K; } else if (buffer_bucket.Flags.Test(k_bucket_flags_Color) && stream_source == 1) { // alpha is quad.W, which LM color doesn't use PrimaryLightmapColor.R = quat.Vector.I; PrimaryLightmapColor.G = quat.Vector.J; PrimaryLightmapColor.B = quat.Vector.K; } }
public static string ToString(LowLevel.Math.real_quaternion values) { return(string.Format("[Skip]")); }
void ReconstructRawVertex(global_geometry_section_info_struct section_info, int stream_source, BlamLib.Render.VertexBufferInterface.StreamReader stream_reader) { LowLevel.Math.real_quaternion quat = new LowLevel.Math.real_quaternion(); if (stream_source == 0) { if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypePosition, ref quat)) { Point.Position.X = quat.Vector.I; Point.Position.Y = quat.Vector.J; Point.Position.Z = quat.Vector.K; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeNodeIndices, ref quat)) { Point.NodeIndex[0].Value = ((int)quat.Vector.I) - 1; Point.NodeIndex[1].Value = ((int)quat.Vector.J) - 1; Point.NodeIndex[2].Value = ((int)quat.Vector.K) - 1; Point.NodeIndex[3].Value = ((int)quat.W) - 1; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeNodeWeights, ref quat)) { Point.NodeWeight[0].Value = quat.Vector.I; Point.NodeWeight[1].Value = quat.Vector.J; Point.NodeWeight[2].Value = quat.Vector.K; Point.NodeWeight[3].Value = quat.W; } } else if (stream_source == 1) { if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeTexCoord, ref quat)) { Texcoord.X = quat.Vector.I; Texcoord.Y = quat.Vector.J; } } else if (stream_source == 2) { if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeNormal, ref quat)) { Normal.I = quat.Vector.I; Normal.J = quat.Vector.J; Normal.K = quat.Vector.K; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeBinormal, ref quat)) { Binormal.I = quat.Vector.I; Binormal.J = quat.Vector.J; Binormal.K = quat.Vector.K; } if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.kTypeTangent, ref quat)) { Tangent.I = quat.Vector.I; Tangent.J = quat.Vector.J; Tangent.K = quat.Vector.K; } } if (section_info != null && stream_source > 2) { int x = 2; // The following LM vertex sources only have one element, so we can call this here stream_reader.GetStreamedElement(0, ref quat); if (section_info.SectionLightingFlags.Test(k_lighting_flags_HasLmTexCoords) && stream_source == ++x) { PrimaryLightmapTexcoord.X = quat.Vector.I; PrimaryLightmapTexcoord.Y = quat.Vector.J; } else if (section_info.SectionLightingFlags.Test(k_lighting_flags_HasLmIncRad) && stream_source == ++x) { PrimaryLightmapIncidentDirection.I = quat.Vector.I; PrimaryLightmapIncidentDirection.J = quat.Vector.J; PrimaryLightmapIncidentDirection.K = quat.Vector.K; } else if (section_info.SectionLightingFlags.Test(k_lighting_flags_HasLmColor) && stream_source == ++x) { // alpha is quad.W, which LM color doesn't use PrimaryLightmapColor.R = quat.Vector.I; PrimaryLightmapColor.G = quat.Vector.J; PrimaryLightmapColor.B = quat.Vector.K; } } #region Unused vertex elements // if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.VertexBuffersHalo2.kTypeAnisoBinormal, // ref quat)) // { // AnisotropicBinormal.I = quat.Vector.I; // AnisotropicBinormal.J = quat.Vector.J; // AnisotropicBinormal.K = quat.Vector.K; // } // // if (stream_reader.FindStreamedElement(BlamLib.Render.VertexBufferInterface.VertexBuffersHalo2.kTypeSecondaryTexCoord, // ref quat)) // { // SecondaryTexcoord.X = quat.Vector.I; // SecondaryTexcoord.Y = quat.Vector.J; // } #endregion }
public LowLevel.Math.real_quaternion ToQuaternion() { LowLevel.Math.real_quaternion v = new LowLevel.Math.real_quaternion(); v.Vector.I = I; v.Vector.J = J; v.Vector.K = K; v.W = W; return v; }