Пример #1
0
        void renderableminimap_Render(int minimapleft, int minimaptop, int minimapwidth, int minimapheight)
        {
            //Console.WriteLine("renderableminimap_Render");
            Vector3 intersectpoint = EditingHelper.GetIntersectPoint();

            if (intersectpoint != null)
            {
                Vector2 minimappos = new Vector2(intersectpoint.x * minimapwidth / MetaverseClient.GetInstance().worldstorage.terrainmodel.MapWidth,
                                                 intersectpoint.y * minimapheight / MetaverseClient.GetInstance().worldstorage.terrainmodel.MapHeight);

                //Console.WriteLine("minmappos: " + minimappos);
                //double distancefromcamera = (intersectpoint - camerapos).Det();
                GraphicsHelperFactory.GetInstance().SetMaterialColor(new Color(0, 0, 1));
                Gl.glPushMatrix();
                Gl.glDisable(Gl.GL_LIGHTING);
                Gl.glDisable(Gl.GL_CULL_FACE);
                Gl.glColor3ub(0, 0, 255);
                Gl.glBegin(Gl.GL_POINTS);
                Gl.glVertex2d(minimapleft + minimappos.x, minimaptop + minimappos.y);
                Gl.glEnd();
                Gl.glEnable(Gl.GL_CULL_FACE);
                Gl.glEnable(Gl.GL_LIGHTING);
                Gl.glColor3ub(255, 255, 255);
                //Gl.glTranslated(intersectpoint.x, intersectpoint.y, intersectpoint.z);
                //Gl.glScaled(0.01 * distancefromcamera, 0.01 * distancefromcamera, 0.01 * distancefromcamera);
                //GraphicsHelperFactory.GetInstance().DrawSphere();
                Gl.glPopMatrix();
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="IsInitialMouseclick">When mouse button is initially pressed, this is true.</param>
        void ApplyBrush(bool IsInitialMouseclick)
        {
            if (!(increaseheight || decreaseheight))
            {
                return;
            }

            if (ViewerState.GetInstance().CurrentViewerState != ViewerState.ViewerStateEnum.Terrain)
            {
                return;
            }

            if (CurrentEditBrush.GetInstance().BrushEffect == null ||
                CurrentEditBrush.GetInstance().BrushShape == null)
            {
                return;
            }

            if (!(IsInitialMouseclick || CurrentEditBrush.GetInstance().BrushEffect.Repeat))
            {
                return;
            }

            Vector3 intersectpoint = EditingHelper.GetIntersectPoint();

            if (intersectpoint == null)
            {
                return;
            }

            double x = intersectpoint.x;
            double y = intersectpoint.y;

            if (x >= 0 && y >= 0 &&
                x < (MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightMapWidth) &&
                y < (MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightMapHeight))
            {
                double milliseconds = DateTime.Now.Subtract(LastDateTime).TotalMilliseconds;
                LastDateTime = DateTime.Now;
                CurrentEditBrush.GetInstance().BrushEffect.ApplyBrush(
                    CurrentEditBrush.GetInstance().BrushShape, CurrentEditBrush.GetInstance().BrushSize,
                    x, y, increaseheight, milliseconds);
            }
        }
Пример #3
0
        void CurrentEditSpot_WriteNextFrameEvent(Vector3 camerapos)
        {
            if (ViewerState.GetInstance().CurrentViewerState != ViewerState.ViewerStateEnum.Terrain)
            {
                return;
            }
            Vector3 intersectpoint = EditingHelper.GetIntersectPoint();

            if (intersectpoint != null)
            {
                double distancefromcamera = (intersectpoint - camerapos).Det();
                GraphicsHelperFactory.GetInstance().SetMaterialColor(new Color(0, 0, 1));
                Gl.glPushMatrix();
                Gl.glTranslated(intersectpoint.x, intersectpoint.y, intersectpoint.z + 0.01 * distancefromcamera);
                Gl.glScaled(0.01 * distancefromcamera, 0.01 * distancefromcamera, 0.01 * distancefromcamera);
                GraphicsHelperFactory.GetInstance().DrawSphere();
                Gl.glPopMatrix();
            }
        }
Пример #4
0
        void BrushShapeController_WriteNextFrameEvent(Vector3 camerapos)
        {
            if (ViewerState.GetInstance().CurrentViewerState == ViewerState.ViewerStateEnum.Terrain)
            {
                if (CurrentEditBrush.GetInstance().BrushShape != null)
                {
                    if (CurrentEditBrush.GetInstance().BrushEffect.Repeat)
                    {
                        Vector3 intersectpos = EditingHelper.GetIntersectPoint();
                        if (intersectpos == null)
                        {
                            return;
                        }

                        Gl.glDisable(Gl.GL_LIGHTING);
                        Gl.glColor3ub(0, 255, 200);
                        CurrentEditBrush.GetInstance().BrushShape.Render(intersectpos);
                        Gl.glColor3ub(255, 255, 255);
                        Gl.glEnable(Gl.GL_LIGHTING);
                    }
                }
            }
        }