Ejemplo n.º 1
0
 public ObjectBrowser(MeshCreatorControl control)
 {
     InitializeComponent();
     this.control           = control;
     this.inputBox          = new InputMessageBox();
     this.selectLayerDialog = new ObjectBrowserSelectLayer();
 }
Ejemplo n.º 2
0
        public Grid(MeshCreatorControl control)
        {
            this.control = control;

            //El bounding box del piso es bien grande para hacer colisiones
            boundingBox = new TgcBoundingBox(new Vector3(-BIG_VAL, -SMALL_VAL, -BIG_VAL), new Vector3(BIG_VAL, 0, BIG_VAL));

            //Planos para colision de picking
            pickingXZAabb = new TgcBoundingBox(new Vector3(-BIG_VAL, -SMALL_VAL, -BIG_VAL), new Vector3(BIG_VAL, 0, BIG_VAL));
            pickingXYAabb = new TgcBoundingBox(new Vector3(-BIG_VAL, -BIG_VAL, -SMALL_VAL), new Vector3(BIG_VAL, BIG_VAL, 0));
            pickingYZAabb = new TgcBoundingBox(new Vector3(-SMALL_VAL, -BIG_VAL, -BIG_VAL), new Vector3(0, BIG_VAL, BIG_VAL));

            vertices = new CustomVertex.PositionColored[12 * 2 * 2];
            int color = Color.FromArgb(76, 76, 76).ToArgb();

            //10 lineas horizontales en X
            for (int i = 0; i < 11; i++)
            {
                vertices[i * 2]     = new CustomVertex.PositionColored(-GRID_RADIUS, 0, -GRID_RADIUS + LINE_SEPARATION * i, color);
                vertices[i * 2 + 1] = new CustomVertex.PositionColored(GRID_RADIUS, 0, -GRID_RADIUS + LINE_SEPARATION * i, color);
            }

            //10 lineas horizontales en Z
            for (int i = 11; i < 22; i++)
            {
                vertices[i * 2]     = new CustomVertex.PositionColored(-GRID_RADIUS * 3 + LINE_SEPARATION * i - LINE_SEPARATION, 0, -GRID_RADIUS, color);
                vertices[i * 2 + 1] = new CustomVertex.PositionColored(-GRID_RADIUS * 3 + LINE_SEPARATION * i - LINE_SEPARATION, 0, GRID_RADIUS, color);
            }
        }
Ejemplo n.º 3
0
 public SelectionRectangle(MeshCreatorControl control)
 {
     this.control                  = control;
     this.rectMesh                 = new SelectionRectangleMesh();
     auxBoundingBoxList            = new List <TgcBoundingBox>();
     this.selectiveObjectsAdditive = false;
 }
Ejemplo n.º 4
0
 public EditorPrimitive(MeshCreatorControl control)
 {
     this.control        = control;
     this.selected       = false;
     this.userProperties = new Dictionary <string, string>();
     this.layer          = control.CurrentLayer;
     this.modifyCaps     = new ModifyCapabilities();
     this.visible        = true;
 }
Ejemplo n.º 5
0
 public EditorPrimitive(MeshCreatorControl control)
 {
     this.control = control;
     this.selected = false;
     this.userProperties = new Dictionary<string, string>();
     this.layer = control.CurrentLayer;
     this.modifyCaps = new ModifyCapabilities();
     this.visible = true;
 }
Ejemplo n.º 6
0
        public ScaleGizmo(MeshCreatorControl control)
            : base(control)
        {
            selectedAxis = Axis.None;
            currentState = State.Init;

            boxX = TgcBox.fromExtremes(new Vector3(0, 0, 0), new Vector3(LARGE_AXIS_SIZE, SHORT_AXIS_SIZE, SHORT_AXIS_SIZE), Color.FromArgb(200, 50, 50));
            boxY = TgcBox.fromExtremes(new Vector3(0, 0, 0), new Vector3(SHORT_AXIS_SIZE, LARGE_AXIS_SIZE, SHORT_AXIS_SIZE), Color.FromArgb(50, 200, 50));
            boxZ = TgcBox.fromExtremes(new Vector3(0, 0, 0), new Vector3(SHORT_AXIS_SIZE, SHORT_AXIS_SIZE, LARGE_AXIS_SIZE), Color.FromArgb(50, 50, 200));
        }
Ejemplo n.º 7
0
        public ScaleGizmo(MeshCreatorControl control)
            : base(control)
        {
            selectedAxis = Axis.None;
            currentState = State.Init;

            boxX = TgcBox.fromExtremes(new Vector3(0, 0, 0), new Vector3(LARGE_AXIS_SIZE, SHORT_AXIS_SIZE, SHORT_AXIS_SIZE), Color.FromArgb(200, 50, 50));
            boxY = TgcBox.fromExtremes(new Vector3(0, 0, 0), new Vector3(SHORT_AXIS_SIZE, LARGE_AXIS_SIZE, SHORT_AXIS_SIZE), Color.FromArgb(50, 200, 50));
            boxZ = TgcBox.fromExtremes(new Vector3(0, 0, 0), new Vector3(SHORT_AXIS_SIZE, SHORT_AXIS_SIZE, LARGE_AXIS_SIZE), Color.FromArgb(50, 50, 200));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Construir un EditablePoly a partir de un mesh
 /// </summary>
 public EditablePoly(MeshCreatorControl control, TgcMesh origMesh)
 {
     this.control = control;
     this.currentPrimitive = PrimitiveType.None;
     this.rectMesh = new SelectionRectangleMesh();
     this.selectionList = new List<EditPolyPrimitive>();
     this.primitiveRenderer = new PrimitiveRenderer(this);
     this.translateGizmo = new EditablePolyTranslateGizmo(this);
     this.deletedTriangles = new List<int>();
     loadMesh(origMesh);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Construir un EditablePoly a partir de un mesh
 /// </summary>
 public EditablePoly(MeshCreatorControl control, TgcMesh origMesh)
 {
     this.control           = control;
     this.currentPrimitive  = PrimitiveType.None;
     this.rectMesh          = new SelectionRectangleMesh();
     this.selectionList     = new List <EditPolyPrimitive>();
     this.primitiveRenderer = new PrimitiveRenderer(this);
     this.translateGizmo    = new EditablePolyTranslateGizmo(this);
     this.deletedTriangles  = new List <int>();
     loadMesh(origMesh);
 }
Ejemplo n.º 10
0
        public MeshPrimitive(MeshCreatorControl control, TgcMesh mesh)
            : base(control)
        {
            //this.Name = mesh.Name + "_" + EditorPrimitive.PRIMITIVE_COUNT++;
            this.Name = mesh.Name;
            this.mesh = mesh;
            this.editablePolyEnabled = false;

            //Ver si tiene texturas
            if (mesh.RenderType == TgcMesh.MeshRenderType.DIFFUSE_MAP || mesh.RenderType == TgcMesh.MeshRenderType.DIFFUSE_MAP_AND_LIGHTMAP)
            {
                //Tiene, habilitar la edicion
                this.ModifyCaps.ChangeTexture  = true;
                this.ModifyCaps.ChangeOffsetUV = true;
                this.ModifyCaps.ChangeTilingUV = true;
                this.ModifyCaps.TextureNumbers = mesh.DiffuseMaps.Length;
                this.originalUVCoords          = mesh.getTextureCoordinates();
            }
            else
            {
                //No tiene textura, deshabilitar todo
                this.ModifyCaps.ChangeTexture  = false;
                this.ModifyCaps.ChangeOffsetUV = false;
                this.ModifyCaps.ChangeTilingUV = false;
                this.ModifyCaps.TextureNumbers = 0;
            }

            this.UserProperties = this.mesh.UserProperties;
            this.uvOffset       = new Vector2(0, 0);
            this.uvTile         = new Vector2(1, 1);

            //Layer
            if (this.mesh.Layer != null && this.mesh.Layer.Length > 0)
            {
                this.Layer = this.mesh.Layer;
            }
            else
            {
                this.Layer = control.CurrentLayer;
            }

            //Ubicar mesh en el origen de coordenadas respecto del centro de su AABB
            setMeshToOrigin();
        }
Ejemplo n.º 11
0
        public MeshPrimitive(MeshCreatorControl control, TgcMesh mesh)
            : base(control)
        {
            //this.Name = mesh.Name + "_" + EditorPrimitive.PRIMITIVE_COUNT++;
            this.Name = mesh.Name;
            this.mesh = mesh;
            this.editablePolyEnabled = false;

            //Ver si tiene texturas
            if(mesh.RenderType == TgcMesh.MeshRenderType.DIFFUSE_MAP || mesh.RenderType == TgcMesh.MeshRenderType.DIFFUSE_MAP_AND_LIGHTMAP)
            {
                //Tiene, habilitar la edicion
                this.ModifyCaps.ChangeTexture = true;
                this.ModifyCaps.ChangeOffsetUV = true;
                this.ModifyCaps.ChangeTilingUV = true;
                this.ModifyCaps.TextureNumbers = mesh.DiffuseMaps.Length;
                this.originalUVCoords = mesh.getTextureCoordinates();
            }
            else
            {
                //No tiene textura, deshabilitar todo
                this.ModifyCaps.ChangeTexture = false;
                this.ModifyCaps.ChangeOffsetUV = false;
                this.ModifyCaps.ChangeTilingUV = false;
                this.ModifyCaps.TextureNumbers = 0;
            }
            
            this.UserProperties = this.mesh.UserProperties;
            this.uvOffset = new Vector2(0, 0);
            this.uvTile = new Vector2(1, 1);

            //Layer
            if (this.mesh.Layer != null && this.mesh.Layer.Length > 0)
            {
                this.Layer = this.mesh.Layer;
            }
            else
            {
                this.Layer = control.CurrentLayer;
            }

            //Ubicar mesh en el origen de coordenadas respecto del centro de su AABB
            setMeshToOrigin();
        }
Ejemplo n.º 12
0
 public BoxPrimitive(MeshCreatorControl control)
     : base(control)
 {
     this.Name = "Box_" + EditorPrimitive.PRIMITIVE_COUNT++;
 }
Ejemplo n.º 13
0
 public EditorGizmo(MeshCreatorControl control)
 {
     this.control = control;
 } 
Ejemplo n.º 14
0
 /// <summary>
 /// Liberar recursos
 /// </summary>
 public void dispose()
 {
     control = null;
     primitiveRenderer.dispose();
 }
Ejemplo n.º 15
0
 public TranslateGizmo(MeshCreatorControl control)
     : base(control)
 {
     gizmoMesh = new TranslateGizmoMesh();
     currentState = State.Init;
 }
Ejemplo n.º 16
0
 public MeshCreatorModifier(string varName, TgcMeshCreator creator)
     : base(varName)
 {
     control = new MeshCreatorControl(creator);
     contentPanel.Controls.Add(control);
 }
Ejemplo n.º 17
0
 public TranslateGizmo(MeshCreatorControl control)
     : base(control)
 {
     gizmoMesh    = new TranslateGizmoMesh();
     currentState = State.Init;
 }
Ejemplo n.º 18
0
 public BoxPrimitive(MeshCreatorControl control)
     : base(control)
 {
     this.Name = "Box_" + EditorPrimitive.PRIMITIVE_COUNT++;
 }
Ejemplo n.º 19
0
 public PlaneXYPrimitive(MeshCreatorControl control)
     : base(control)
 {
     this.Name = "Plane_" + EditorPrimitive.PRIMITIVE_COUNT++;
     this.ModifyCaps.ChangeRotation = false;
 }
Ejemplo n.º 20
0
 public PlaneXZPrimitive(MeshCreatorControl control)
     : base(control)
 {
     this.Name = "Plane_" + EditorPrimitive.PRIMITIVE_COUNT++;
     this.ModifyCaps.ChangeRotation = false;
 }
Ejemplo n.º 21
0
 public SpherePrimitive(MeshCreatorControl control)
     : base(control)
 {
     this.bb = new TgcBoundingBox();
     this.Name = "Sphere_" + EditorPrimitive.PRIMITIVE_COUNT++;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Liberar recursos
 /// </summary>
 public void dispose()
 {
     control = null;
     primitiveRenderer.dispose();
 }
Ejemplo n.º 23
0
 public EditorGizmo(MeshCreatorControl control)
 {
     this.control = control;
 }
Ejemplo n.º 24
0
 public SpherePrimitive(MeshCreatorControl control)
     : base(control)
 {
     this.bb   = new TgcBoundingBox();
     this.Name = "Sphere_" + EditorPrimitive.PRIMITIVE_COUNT++;
 }