public VdsVec4d(VdsVec4d v) { R = v.R; G = v.G; B = v.B; A = v.A; }
public VdsVec4d PostMult(VdsVec4d v) { return(new VdsVec4d((_mat[0, 0] * v.R + _mat[0, 1] * v.G + _mat[0, 2] * v.B + _mat[0, 3] * v.A), (_mat[1, 0] * v.R + _mat[1, 1] * v.G + _mat[1, 2] * v.B + _mat[1, 3] * v.A), (_mat[2, 0] * v.R + _mat[2, 1] * v.G + _mat[2, 2] * v.B + _mat[2, 3] * v.A), (_mat[3, 0] * v.R + _mat[3, 1] * v.G + _mat[3, 2] * v.B + _mat[3, 3] * v.A))); }
public VdsQuat(VdsVec4d v) { _v[0] = v.R; _v[1] = v.G; _v[2] = v.B; _v[3] = v.A; }
public static VdsQuat Slerp(double interpolationValue, VdsQuat from, VdsQuat to) { double epsilon = 0.00001; double omega, cosomega, sinomega, scaleFrom, scaleTo; VdsQuat quatTo = new VdsQuat(); quatTo.SetQuat(to); VdsVec4d f = new VdsVec4d(from._v[0], from._v[1], from._v[2], from._v[3]); VdsVec4d t = new VdsVec4d(to._v[0], to._v[1], to._v[2], to._v[3]); cosomega = f * t; if (cosomega < 0.0) { cosomega = -cosomega; quatTo = -to; } if ((1.0 - cosomega) > epsilon) { omega = Math.Acos(cosomega); sinomega = Math.Sin(omega); scaleFrom = Math.Sin((1.0 - interpolationValue) * omega) / sinomega; scaleTo = Math.Sin(interpolationValue * omega) / sinomega; } else { scaleFrom = 1.0 - interpolationValue; scaleTo = interpolationValue; } VdsQuat resultQuat = new VdsQuat(); resultQuat = (from * scaleFrom) + (quatTo * scaleTo); return(resultQuat); }
public UILabel(int viewID) : base(viewID) { TextColor = new VdsVec4d(0, 0, 0, 1); TextFont = "msyhl.ttc"; TextSize = 12; Backdrop = BackdropType.OUTLINE; BackdropColor = new VdsVec4d(1, 1, 1, 1); Alignment = AlignmentType.LEFT_CENTER; LabelMargin = new VdsVec4d(10, 5, 10, 5); }
public void FromString(string str) { char[] c = new char[1] { ',' }; string[] vList = str.Split(c, StringSplitOptions.RemoveEmptyEntries); List <VdsVec4d> resultList = new List <VdsVec4d>(vList.Length); for (int i = 0; i < vList.Length; ++i) { VdsVec4d v = new VdsVec4d(); v.FromString(vList[i]); resultList.Add(v); } ValueList = resultList; }
public void UpdateGeometry() { if (VertexArray == null) { return; } int updateThreadID = GlobalEnvironment.UpdateThreadID; int curThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; if (updateThreadID != curThreadID) { return; } VdsVec3d[] vArray = VertexArray.ToArray(); VdsVec3d[] nArray = null; if (NormalArray != null) { nArray = NormalArray.ToArray(); } else { nArray = new VdsVec3d[0]; } VdsVec4d[] cArray = null; if (ColorArray != null) { cArray = ColorArray.ToArray(); } else { cArray = new VdsVec4d[0]; } VdsVec2d[] tArray = null; if (TexCoordArray != null) { tArray = TexCoordArray.ToArray(); } else { tArray = new VdsVec2d[0]; } VdsVec4d[] maturalArray = null; if (AmbientMatural == null && DiffuseMatural == null && SpecularMatural == null && EmissionMatural == null) { maturalArray = new VdsVec4d[0]; } else { maturalArray = new VdsVec4d[4]; if (AmbientMatural == null) { maturalArray[0] = new VdsVec4d(0.8, 0.8, 0.8, 1.0); } else { maturalArray[0] = AmbientMatural; } if (DiffuseMatural == null) { maturalArray[1] = new VdsVec4d(0.9, 0.9, 0.9, 1.0); } else { maturalArray[1] = DiffuseMatural; } if (SpecularMatural == null) { maturalArray[2] = new VdsVec4d(0.95, 0.95, 0.95, 1.0); } else { maturalArray[2] = SpecularMatural; } if (EmissionMatural == null) { maturalArray[3] = new VdsVec4d(0.1, 0.1, 0.1, 1.0); } else { maturalArray[3] = EmissionMatural; } } string tFileName = ""; if (TextureFileName != null) { tFileName = TextureFileName; } int drawMode = 0; switch (DrawMode) { case GeometryDrawModel.POINTS: drawMode = 0; break; case GeometryDrawModel.LINES: drawMode = 1; break; case GeometryDrawModel.LINE_STRIP: drawMode = 3; break; case GeometryDrawModel.LINE_LOOP: drawMode = 2; break; case GeometryDrawModel.TRIANGLES: drawMode = 4; break; case GeometryDrawModel.TRIANGLE_STRIP: drawMode = 5; break; case GeometryDrawModel.TRIANGLE_FAN: drawMode = 6; break; case GeometryDrawModel.QUADS: drawMode = 7; break; case GeometryDrawModel.QUAD_STRIP: drawMode = 8; break; } IUpdateGeometry(this.NativeHandle, vArray, nArray, cArray, tArray, drawMode, (int)CullFaceMode, tFileName, maturalArray); }