예제 #1
0
        void DrawSelectionHandle()
        {
            graphics.PushMatrix();

            graphics.Scale(1.5, 1.5, 1.5);
            Glu.GLUquadric quadratic = Glu.gluNewQuadric();   // Create A Pointer To The Quadric Entity

            Glu.gluQuadricNormals(quadratic, Glu.GLU_SMOOTH); // Create Smooth Normals

            Glu.gluQuadricOrientation(quadratic, Glu.GLU_OUTSIDE);
            graphics.Translate(0.0f, 0.0f, -0.025f);   // Center The Cylinder
            Glu.gluCylinder(quadratic, 0.5f, 0.5f, 0.05f, 20, 3);

            Glu.gluQuadricOrientation(quadratic, Glu.GLU_INSIDE);
            Glu.gluCylinder(quadratic, 0.48f, 0.5f, 0.05f, 20, 3);

            Glu.gluQuadricOrientation(quadratic, Glu.GLU_OUTSIDE);

            graphics.Rotate(180.0f, 1.0f, 0.0f, 0.0f);
            Glu.gluDisk(quadratic, 0.48f, 0.5f, 20, 3);

            graphics.Rotate(180.0f, 1.0f, 0.0f, 0.0f);
            graphics.Translate(0.0f, 0.0f, 0.05f);
            Glu.gluDisk(quadratic, 0.48f, 0.5f, 20, 3);


            graphics.PopMatrix();
        }
예제 #2
0
        //! Draws hardcoded platern that we start over
        //! This is a temporary function since land will be migrated to the databse
        void DrawLandscape()
        {
            IPicker3dModel picker3dmodel = RendererFactory.GetPicker3dModel();

            int i, iy;

            // Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, new float[]{(float)rand.GetRandomFloat(0,1), 0.7f, 0.2f, 1.0f});
            Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, new float[] { 0.7f, 0.7f, 0.2f, 1.0f });

            int iLandCoord = 0;

            for (iy = -10; iy <= 10; iy++)
            {
                for (i = -10; i <= 10; i++)
                {
                    LandCoords[iLandCoord] = new Vector2(-10.0F + i * 1.0F, -10.0F + iy * 1.0F);
                    picker3dmodel.AddHitTarget(new HitTargetLandCoord(iLandCoord));

                    graphics.PushMatrix();

                    graphics.Translate(-10.0F + i * 1.0F, -10.0F + iy * 1.0F, MetaverseClient.GetInstance().fHeight - 0.5);
                    graphics.DrawCube();

                    graphics.PopMatrix();
                    iLandCoord++;
                }
            }
        }
예제 #3
0
        public void DrawEditBarsToOpenGL(Vector3 camerapos)
        {
            if (bShowEditBars)
            {
                Entity entity = selectionmodel.GetFirstSelectedEntity();
                if (entity == null)
                {
                    return;
                }

                IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();

                graphics.PushMatrix();

                if (entity.Parent == null)
                {
                    //entity.DrawSelected();
                }
                else
                {
                    (entity.Parent as EntityGroup).ApplyTransforms();
                }

                graphics.Translate(entity.pos);
                graphics.Rotate(entity.rot);

                // Vector3[] FaceCentreOffsets = new Vector3[6];

                double distance = (entity.pos - camerapos).Det();

                Vector3 ScaleToUse = entity.scale;

                switch (editbartype)
                {
                case EditBarType.Pos:
                    editing3dpos.DrawEditHandles(ScaleToUse, distance);
                    //editing3dscale.DrawEditHandles(ScaleToUse, distance);
                    break;

                case EditBarType.Scale:
                    editing3dscale.DrawEditHandles(ScaleToUse, distance);
                    break;

                case EditBarType.Rot:
                    editing3drot.DrawEditHandles(ScaleToUse);
                    break;
                }

                graphics.PopMatrix();
            }
        }
예제 #4
0
        public override void DrawSelected()
        {
            IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();

            graphics.SetMaterialColor(new Color(0.2, 0.7, 1.0));
            graphics.PushMatrix();
            graphics.Translate(pos);
            graphics.Rotate(rot);
            graphics.Scale(scale);

            graphics.DrawWireframeBox(10);

            graphics.PopMatrix();
        }
예제 #5
0
        public override void DrawSelected()
        {
            IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();

            graphics.SetMaterialColor(SelectionView.GetInstance().SelectionGridColor);
            graphics.PushMatrix();
            graphics.Translate(pos);
            graphics.Rotate(rot);
            graphics.Scale(scale);

            graphics.DrawWireframeBox(SelectionView.GetInstance().SelectionGridNumLines);

            graphics.PopMatrix();
        }
예제 #6
0
        void DrawSingleEditHandle(Vector3 entityscale, Vector3 handlescale, Axis handleaxis)
        {
            graphics.PushMatrix();
            graphics.SetMaterialColor(editing3d.GetEditHandleColor(handleaxis));
            RendererFactory.GetPicker3dModel().AddHitTarget(new HitTargetEditHandle(new Axis(handleaxis)));
            double fTranslateAmount = (handleaxis.GetAxisComponentIgnoreAxisDirection(entityscale) + handleaxis.GetAxisComponentIgnoreAxisDirection(handlescale)) / 2;

            graphics.Translate(fTranslateAmount * handleaxis.ToVector());
            graphics.Scale(handlescale);
            graphics.Rotate(handleaxis.ToRot());

            graphics.DrawCube();

            graphics.PopMatrix();
        }
예제 #7
0
        public override void RenderSingleFace(int ifacenum)
        {
            IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();

            graphics.PushMatrix();

            graphics.SetMaterialColor(facecolors[0]);
            graphics.Translate(pos);
            graphics.Rotate(rot);
            graphics.Scale(scale);

            primitive.RenderSingleFace(ifacenum);

            graphics.PopMatrix();
        }
예제 #8
0
        public override void Draw()
        {
            // Test.Debug("cube draw");
            IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();

            graphics.PushMatrix();

            // Test.Debug( this.ToString() );
            graphics.SetMaterialColor(facecolors[0]);
            graphics.Translate(pos);
            graphics.Rotate(rot);
            graphics.Scale(scale);

            graphics.DrawCone();

            graphics.PopMatrix();
        }
예제 #9
0
        public override void Draw()
        {
            //Test.Debug("EntityGroup.Draw()");
            IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();
            //SelectionModel selectionmodel = SelectionModel.GetInstance();
            Picker3dController picker3dcontroller = Picker3dController.GetInstance();

            if (graphics == null)
            {
                return;
            }

            graphics.PushMatrix();
            graphics.Translate(pos);

            bool bNeedToPopMatrix   = false;
            bool bRotatedToGroupRot = false;

            //for( int iSubEntityRef = 0; iSubEntityRef < iNumSubEntities; iSubEntityRef++ )
            foreach (Entity child in children)
            {
                if (!bRotatedToGroupRot)
                {
                    // dont rotate first prim in elevation for avatars (looks better like this)
                    //if( strcmp( sDeepEntityType, "AVATAR" ) != 0 )
                    if (true)  // Just display all avatars as is for now( we should put this back in though probably)
                    {
                        graphics.Rotate(rot);
                        bRotatedToGroupRot = true;
                    }

                    picker3dcontroller.AddHitTarget(child);
                    child.Draw();
                }

                if (bNeedToPopMatrix)
                {
                    graphics.PopMatrix();
                }
            }
            graphics.PopMatrix();
        }
예제 #10
0
        public void Render()
        {
            SelectionModel  selectionmodel = SelectionModel.GetInstance();
            IGraphicsHelper graphics       = GraphicsHelperFactory.GetInstance();

            for (int i = 0; i < selectionmodel.SelectedObjects.Count; i++)
            {
                Entity entity = selectionmodel.SelectedObjects[i];

                graphics.PushMatrix();

                if (entity.Parent != null)
                {
                    (entity as EntityGroup).ApplyTransforms();
                }

                entity.DrawSelected();
                graphics.PopMatrix();
            }
        }