Ejemplo n.º 1
0
        public void MouseMoveEvent(int viewID, int x, int y)
        {
            if (VdsViewEventEvent_MouseMoveEvent == null || VdsViewEventEvent_MouseMoveEvent.GetInvocationList().GetLength(0) < 1)
            {
                return;
            }
            VEventArgs eArgs = new VEventArgs();
            VdsVec2d   pos   = new VdsVec2d(x, y);

            eArgs.ViewID        = viewID;
            eArgs.EventPosition = pos;
            VdsViewEventEvent_MouseMoveEvent(null, eArgs);
        }
Ejemplo n.º 2
0
        public void FromString(string str)
        {
            char[] c = new char[1] {
                ','
            };
            string[]        vList      = str.Split(c, StringSplitOptions.RemoveEmptyEntries);
            List <VdsVec2d> resultList = new List <VdsVec2d>(vList.Length);

            for (int i = 0; i < vList.Length; ++i)
            {
                VdsVec2d v = new VdsVec2d();
                v.FromString(vList[i]);
                resultList.Add(v);
            }
            ValueList = resultList;
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public VdsVec2d(VdsVec2d v)
 {
     X = v.X;
     Y = v.Y;
 }
Ejemplo n.º 5
0
 public virtual void InitUI(int viewID)
 {
     SetNativeHandle(CreateInternal(this.GetType().FullName, viewID));
     WidgetPosition = new VdsVec2d(0, 0);
     IsShow         = false;
 }