예제 #1
0
파일: FormViewer3D.cs 프로젝트: Sadral/TRRM
        private void drawMeshes(Matrix viewProjMatrix, float radians)
        {
            if (meshes.Count == 0)
            {
                return;
            }

            using (EffectBlock effect = new EffectBlock(lightEffect))
            {
                effect.Effect.SetValue("gAmbientLight", new Color4(0.5f, 0.5f, 0.5f, 1.0f));
                effect.Effect.SetValue("gDiffuseLight", new Color4(0.9f, 0.9f, 0.9f, 1.9f));
                effect.Effect.SetValue("gDiffuseVecW", new Vector3(1.0f, -0.5f, -1.0f));

                Data.BoundingBox fullBox     = new Data.BoundingBox(meshes.Select(m => m.BoundingBox).ToList());
                Matrix           worldMatrix = Matrix.Invert(Matrix.Translation(fullBox.Origin));
                foreach (var mesh in meshes)
                {
                    if (mesh.Ready)
                    {
                        mesh.Rotation = Matrix.Multiply(mesh.Rotation, Matrix.RotationAxis(Vector3.Up, radians));
                        drawMesh(worldMatrix, viewProjMatrix, mesh, effect.Effect);
                    }
                }
            }
        }
예제 #2
0
파일: FormViewer3D.cs 프로젝트: Sadral/TRRM
        private void drawTestCube(Matrix viewProjMatrix, float radians)
        {
            if (testCube == null)
            {
                return;
            }

            using (EffectBlock effect = new EffectBlock(basicEffect))
            {
                testCube.Rotation = testCube.Rotation * Matrix.RotationAxis(Vector3.Up, radians);
                drawMesh(Matrix.Identity, viewProjMatrix, testCube, effect.Effect);
            }
        }