Exemple #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();
        }
Exemple #2
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.Rotate(90, 0, 1, 0);

            graphics.DrawCone();
            RendererFactory.GetPicker3dModel().EndHitTarget();
            graphics.PopMatrix();
        }
Exemple #3
0
        public void ApplyTransforms()
        {
            IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance();

            if (Parent != null)
            {
                EntityGroup parententity = Parent as EntityGroup;
                parententity.ApplyTransforms();
            }
            graphics.Translate(pos);
            graphics.Rotate(rot);
        }
Exemple #4
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();
            }
        }
Exemple #5
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();
        }
        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();
        }
        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();
        }
Exemple #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();
        }
Exemple #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();
        }