コード例 #1
0
 public MeshBox(string name, Mesh mesh, int subsetcount, Material mat, MeshTransform transform) : base(name, transform)
 {
     this.mesh = mesh;
     this.mat  = mat;
     this.ssc  = subsetcount;
     this.wire = true;
 }
コード例 #2
0
        public NodeBox(string name, MeshTransform transform)
        {
            this.trans = transform;
            this.name  = name;

            parents = new ArrayList();
            childs  = new ArrayList();
        }
コード例 #3
0
        public void AddLightMesh()
        {
            Direct3D.Material mat = new Direct3D.Material();
            mat.Diffuse           = Color.Yellow;
            mat.Ambient           = Color.Yellow;
            mat.Specular          = Color.Yellow;
            mat.SpecularSharpness = 1;

            Direct3D.Material matoff = new Direct3D.Material();
            matoff.Diffuse           = Color.DarkGray;
            matoff.Ambient           = Color.DarkGray;
            matoff.Specular          = Color.DarkGray;
            matoff.SpecularSharpness = 1;
            Mesh m  = Mesh.Sphere(Device, 0.2f, 10, 4);
            Mesh mp = Mesh.Box(Device, 0.2f, 0.2f, 0.2f);

            MeshBox mb;

            for (int i = 0; i < Device.Lights.Count; i++)
            {
                Light l = Device.Lights[i];
                if (!l.Enabled)
                {
                    mb = new MeshBox("Light", m, 1, matoff);
                }
                else
                {
                    mb = new MeshBox("Light", m, 1, mat);
                }

                Vector3 v = l.Position;

                mb.Transform = MeshTransform.Translation(v);
                this.Meshes.Add(mb);

                if (!l.Enabled)
                {
                    mb = new MeshBox("Light", mp, 1, matoff);
                }
                else
                {
                    mb = new MeshBox("Light", mp, 1, mat);
                }
                mb.Transform = MeshTransform.Translation(l.Position + 0.4f * l.Direction);
                this.Meshes.Add(mb);

                if (!l.Enabled)
                {
                    mb = new MeshBox("Light", mp, 1, matoff);
                }
                else
                {
                    mb = new MeshBox("Light", mp, 1, mat);
                }
                mb.Transform = MeshTransform.Translation(l.Position + 0.5f * l.Direction);
                this.Meshes.Add(mb);
            }
        }
コード例 #4
0
        public object Clone()
        {
            MeshTransform mt = new MeshTransform();

            mt.SetTranslation(new Microsoft.DirectX.Vector3(t.X, t.Y, t.Z));
            mt.SetRotation(new Microsoft.DirectX.Quaternion(r.X, r.Y, r.Z, r.W));
            if (mset)
            {
                mt.m = Microsoft.DirectX.Matrix.Multiply(Microsoft.DirectX.Matrix.Identity, this.m);
            }
            mt.mset = this.mset;
            return(mt);
        }
コード例 #5
0
        public void AddAxisMesh()
        {
            Direct3D.Material mat = new Direct3D.Material();
            mat.Diffuse           = Color.Red;
            mat.Ambient           = mat.Diffuse;
            mat.Specular          = mat.Diffuse;
            mat.SpecularSharpness = 1;



            Mesh    m  = Mesh.Cylinder(device, 0.001f, 0.001f, 1, 6, 1);
            MeshBox mb = new MeshBox("Axis", m, 1, mat);

            mb.Transform = MeshTransform.Translation(new Vector3(0, 0, 0));
            mb.Wire      = false;
            this.Meshes.Add(mb);

            mat.Diffuse  = Color.Green;
            mat.Ambient  = mat.Diffuse;
            mat.Specular = mat.Diffuse;
            m            = Mesh.Cylinder(device, 0.001f, 0.001f, 1, 6, 1);
            mb           = new MeshBox("Axis", m, 1, mat);
            mb.Transform = MeshTransform.RotationYawPitchRoll(
                0,
                -Math.PI / 2.0,
                0
                );
            mb.Wire = false;
            this.Meshes.Add(mb);

            mat.Diffuse  = Color.Blue;
            mat.Ambient  = mat.Diffuse;
            mat.Specular = mat.Diffuse;
            m            = Mesh.Cylinder(device, 0.001f, 0.001f, 1, 6, 1);
            mb           = new MeshBox("Axis", m, 1, mat);
            mb.Transform = MeshTransform.RotationYawPitchRoll(
                -Math.PI / 2.0,
                0,
                0
                );
            mb.Wire = false;
            this.Meshes.Add(mb);
        }
コード例 #6
0
 public MeshBox(string name, Mesh mesh, Material mat, MeshTransform transform) : this(name, mesh, mesh.NumberAttributes, mat, transform)
 {
 }