//! 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++; } } }
public void DrawEditHandles(Vector3 entityscale) { // + x graphics.SetMaterialColor(editing3d.GetEditHandleColor(Axis.PosX)); //graphics.SetMaterialColor( new double[]{ 1.0, 0.0, 0.0, 0.5 } ); RendererFactory.GetPicker3dModel().AddHitTarget(new HitTargetEditHandle(Axis.PosX)); graphics.PushMatrix(); graphics.Scale(entityscale); graphics.Rotate(90f, 0f, 1f, 0f); DrawSelectionHandle(); graphics.PopMatrix(); // + y graphics.SetMaterialColor(editing3d.GetEditHandleColor(Axis.PosY)); RendererFactory.GetPicker3dModel().AddHitTarget(new HitTargetEditHandle(Axis.PosY)); graphics.PushMatrix(); graphics.Scale(entityscale); graphics.Rotate(90, 1, 0, 0); DrawSelectionHandle(); graphics.PopMatrix(); // + z graphics.SetMaterialColor(editing3d.GetEditHandleColor(Axis.PosZ)); RendererFactory.GetPicker3dModel().AddHitTarget(new HitTargetEditHandle(Axis.PosZ)); graphics.PushMatrix(); graphics.Scale(entityscale); //Gl.glRotatef( 90, 0, 1, 0 ); DrawSelectionHandle(); graphics.PopMatrix(); }
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(); }
public void InitiateScaleEdit(int mousex, int mousey) { EditingPreliminaries(); HitTarget hittarget = RendererFactory.GetPicker3dModel().GetClickedHitTarget(mousex, mousey); //Test.Debug( "Clicked target type: " + hittarget.TargetType ); // Test.Debug if (hittarget is HitTargetEditHandle) { Test.Debug("It's an edit handle :-O"); // Test.Debug editing3dscale.InitiateHandleEdit(mousex, mousey, (( HitTargetEditHandle)hittarget).axis); } else { Test.Debug("Not an edit handle"); // Test.Debug editing3dscale.InitiateFreeEdit(mousex, mousey); } }