Esempio n. 1
0
        public override void Initialize()
        {
            //Create the Block mesh
            IMeshFactory meshfactory = new MilkShape3DMeshFactory();

            meshfactory.LoadMesh(@"\Meshes\block.txt", out _meshBluePrint, 0);

            _staticBlockVB = ToDispose(new VertexBuffer <VertexMesh>(_engine.Device,
                                                                     _meshBluePrint.Vertices.Length,
                                                                     SharpDX.Direct3D.PrimitiveTopology.TriangleList,
                                                                     "rotatingBlockVB"));
            _staticBlockIB = ToDispose(new IndexBuffer <ushort>(_engine.Device, _meshBluePrint.Indices.Length, "rotatingBlockIB"));

            _cubeShader = ToDispose(new HLSLLoadingCube(_engine.Device,
                                                        ClientSettings.EffectPack + @"Entities/LoadingCube.hlsl",
                                                        VertexMesh.VertexDeclaration));

            RotationCube cube;

            //Create Cubes 1
            cube = new RotationCube
            {
                ID               = 0,
                Rotation         = new Vector3(-MathHelper.Pi * 6 / 5, MathHelper.PiOver4, 0),
                SpinningRotation = new Vector3(0.01f, 0.02f, 0.0001f)
            };
            _rotatingCubes.Add(cube);

            cube = new RotationCube
            {
                ID               = 1,
                Rotation         = new Vector3(-MathHelper.PiOver2 * 6 * 1.2f, MathHelper.PiOver2 * 0.125f, MathHelper.Pi * 1.23f),
                SpinningRotation = new Vector3(0.01f, 0.01f, 0.001f)
            };
            _rotatingCubes.Add(cube);

            cube = new RotationCube
            {
                ID               = 2,
                Rotation         = new Vector3(-MathHelper.PiOver2 * 1.9f, MathHelper.PiOver2 * 0.6f, MathHelper.Pi * 1.3f),
                SpinningRotation = new Vector3(0.001f, 0.05f, 0.002f)
            };
            _rotatingCubes.Add(cube);

            cube = new RotationCube
            {
                ID               = 3,
                Rotation         = new Vector3(-MathHelper.PiOver2 * 1.6f, MathHelper.PiOver2 * 0.9f, MathHelper.Pi * 1.9f),
                SpinningRotation = new Vector3(0.001f, 0.0004f, 0.03f)
            };
            _rotatingCubes.Add(cube);

            Resize(_engine.ViewPort);
        }
Esempio n. 2
0
        public override void Initialize()
        {
            base.Initialize();

            _loadingLabel = new LabelControl
            {
                Text       = "LOADING...",
                Color      = Color.White,
                CustomFont = _commonResources.FontBebasNeue50
            };

            _pleaseWaitLabel = new LabelControl
            {
                Text       = "PLEASE WAIT",
                Color      = new Color4(new Color(198, 0, 75, 255).ToRgba()),
                CustomFont = _commonResources.FontBebasNeue25
            };

            _cubeShader = ToDispose(new HLSLLoadingCube(_engine.Device,
                                                        ClientSettings.EffectPack + @"Entities/LoadingCube.hlsl",
                                                        VertexMesh.VertexDeclaration,
                                                        new S33M3DXEngine.Effects.HLSLFramework.EntryPoints()
            {
                VertexShader_EntryPoint = "VS", PixelShader_EntryPoint = "PSColoredCubeWithLight"
            }
                                                        ));

            //Create Vertex/Index Buffer to store the rotating Cube
            _rotatingBlockVB = ToDispose(new VertexBuffer <VertexMesh>(_engine.Device,
                                                                       _meshBluePrint.Vertices.Length,
                                                                       SharpDX.Direct3D.PrimitiveTopology.TriangleList,
                                                                       "rotatingBlockVB"));
            _rotatingBlockIB = ToDispose(new IndexBuffer <ushort>(_engine.Device, _meshBluePrint.Indices.Length, "rotatingBlockIB"));

            _loadingCube = new RotationCube
            {
                Scale            = 70,
                ScreenPosition   = new Vector3((_engine.ViewPort.Width - 168) / 2, (_engine.ViewPort.Height - _headerHeight) / 2 + _headerHeight, 0),
                SpinningRotation = new Vector3(0.05f, 0.1f, 0.0f),
            };
        }