public MtrlFile() { this.unk = new uint[5]; this.Alpha = 1f; this.Id = -1; this.SelfIlluminating = 0; this.ClampU = 0; this.ClampV = 0; this.LightSpecular = 1; this.AffectsAmbient = 1; this.AffectsDiffuse = 1; this.AffectsSpecular = 1; this.AlphaMode = 10; unk2 = new Texel[3] { new Color4D(1f), new Color4D(1f), new Color4D(1f) }; unk3 = new Texel[3] { new Color4D(1f), new Color4D(1f), new Color4D(1f) }; unk4 = new int[4]; Texture = string.Empty; }
public void WriteTexel(Texel t) { this.Write(t.B); this.Write(t.G); this.Write(t.R); this.Write(t.A); }
/// <summary> /// Creates a flat byte array sequence out of a texel /// </summary> /// <param name="txl">The texel to convert</param> /// <param name="arr">the output array</param> /// <param name="startidx">The index to start inserting the texel data</param> private static void TexelToByteSequence(int startidx, byte[] arr, Texel txl) { arr[startidx] = txl.R; arr[startidx + 1] = txl.G; arr[startidx + 2] = txl.B; arr[startidx + 3] = txl.A; }
public LightMap(ModelInstance mi, Mesh m) { model = mi; mesh = m; width = mesh.texels.GetLength(0); height = mesh.texels.GetLength(1); texels = new Texel[width, height]; patches = new List <Patch>(); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { texels[i, j] = new Texel(); foreach (Patch p in mesh.texels[i, j].patches) { Patch temp = new Patch(p, model.transform); texels[i, j].add(temp); patches.Add(temp); } } } name = "lm" + model.layoutName + "_" + convertToBase36(model.id) + "_0" + mesh.id; }
public Texel ReadTexel() { Texel t = new Texel(); t.B = this.ReadByte(); t.G = this.ReadByte(); t.R = this.ReadByte(); t.A = this.ReadByte(); return t; }
public Texel ReadTexel() { Texel t = new Texel(); t.B = this.ReadByte(); t.G = this.ReadByte(); t.R = this.ReadByte(); t.A = this.ReadByte(); return(t); }
void satisfyConstraint(Texel p1, Texel p2) { Vector3 p1_to_p2 = p2.GetPos() - p1.GetPos(); // vector from p1 to p2 float current_distance = p1_to_p2.magnitude; Vector3 correctionVector = p1_to_p2 * (1 - rest_distance / current_distance); Vector3 correctionVectorHalf = correctionVector * 0.5f; p1.OffsetPos(correctionVectorHalf); p2.OffsetPos(-correctionVectorHalf); }
/// <summary> /// Calculate number of words to fit complete instruction bytecode. /// </summary> /// <returns>Number of words in instruction bytecode.</returns> public override uint GetWordCount() { uint wordCount = 0; wordCount += Image.GetWordCount(); wordCount += Coordinate.GetWordCount(); wordCount += Texel.GetWordCount(); wordCount += ImageOperands?.GetWordCount() ?? 0u; return(wordCount); }
/// <summary> /// Write instruction operands into bytecode stream. /// </summary> /// <param name="writer">Bytecode writer.</param> public override void WriteOperands(WordWriter writer) { Image.Write(writer); Coordinate.Write(writer); Texel.Write(writer); if (ImageOperands != null) { ImageOperands.Write(writer); } }
public uint[] unk; //5 #endregion Fields #region Constructors public MtrlFile() { this.unk = new uint[5]; this.Alpha = 1f; this.Id = -1; this.SelfIlluminating = 0; this.ClampU = 0; this.ClampV = 0; this.LightSpecular = 1; this.AffectsAmbient = 1; this.AffectsDiffuse = 1; this.AffectsSpecular = 1; this.AlphaMode = 10; unk2 = new Texel[3] { new Color4D(1f), new Color4D(1f), new Color4D(1f) }; unk3 = new Texel[3] { new Color4D(1f), new Color4D(1f), new Color4D(1f) }; unk4 = new int[4]; Texture = string.Empty; }