Esempio n. 1
0
        /// <inheritdoc />
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            base.LoadResourceInternal(device, resources);

            // Load graphics resources
            _pixelShaderBlur = resources.GetResourceAndEnsureLoaded(
                s_resKeyPixelShaderBlur,
                () => GraphicsHelper.Internals.GetPixelShaderResource(device, "Postprocessing", "PostprocessBlur"));
            _singleForcedColor = resources.GetResourceAndEnsureLoaded(
                s_keyMaterial,
                () => new SingleForcedColorMaterialResource {
                FadeIntensity = _fadeIntensity
            });
            _renderTarget = resources.GetResourceAndEnsureLoaded(
                s_keyRenderTarget,
                () => new RenderTargetTextureResource(RenderTargetCreationMode.Color));
            _defaultResources = resources.DefaultResources;

            // Load constant buffers
            _cbFirstPass = resources.GetResourceAndEnsureLoaded(
                _keyCbPass01,
                () => new TypeSafeConstantBufferResource <CbPerObject>(new CbPerObject
            {
                BlurIntensity = 0.0f,
                BlurOpacity   = 0.1f
            }));
            _cbSecondPass = resources.GetResourceAndEnsureLoaded(
                _keyCbPass02,
                () => new TypeSafeConstantBufferResource <CbPerObject>(new CbPerObject
            {
                BlurIntensity = 0.8f,
                BlurOpacity   = 0.5f
            }));
        }
        /// <summary>
        /// Loads the resource.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="resources">Parent ResourceDictionary.</param>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            base.LoadResourceInternal(device, resources);

            // Load graphics resources
            m_pixelShaderBlur = resources.GetResourceAndEnsureLoaded(
                RES_KEY_PIXEL_SHADER_BLUR,
                () => GraphicsHelper.GetPixelShaderResource(device, "Postprocessing", "PostprocessBlur"));
            m_singleForcedColor = resources.GetResourceAndEnsureLoaded <SingleForcedColorMaterialResource>(
                KEY_MATERIAL,
                () => new SingleForcedColorMaterialResource()
            {
                FadeIntensity = m_fadeIntensity
            });
            m_renderTarget = resources.GetResourceAndEnsureLoaded <RenderTargetTextureResource>(
                KEY_RENDER_TARGET,
                () => new RenderTargetTextureResource(RenderTargetCreationMode.Color));
            m_defaultResources = resources.DefaultResources;

            // Load constant buffers
            m_cbFirstPass = resources.GetResourceAndEnsureLoaded <TypeSafeConstantBufferResource <CBPerObject> >(
                KEY_CB_PASS_01,
                () => new TypeSafeConstantBufferResource <CBPerObject>(new CBPerObject()
            {
                BlurIntensity = 0.0f,
                BlurOpacity   = 0.1f
            }));
            m_cbSecondPass = resources.GetResourceAndEnsureLoaded <TypeSafeConstantBufferResource <CBPerObject> >(
                KEY_CB_PASS_02,
                () => new TypeSafeConstantBufferResource <CBPerObject>(new CBPerObject()
            {
                BlurIntensity = 0.8f,
                BlurOpacity   = 0.5f
            }));
        }
Esempio n. 3
0
        /// <summary>
        /// Loads all resources of this texture painter object.
        /// </summary>
        /// <param name="resources">The target resource dictionary.</param>
        internal void LoadResources(ResourceDictionary resources)
        {
            // Load material
            m_materialResource = resources.GetResourceAndEnsureLoaded <SpriteMaterialResource>(
                KEY_MATERIAL,
                () => new SpriteMaterialResource(m_texture));

            // Load geometry resource
            m_geometryResource = resources.GetResourceAndEnsureLoaded <GeometryResource>(
                KEY_GEOMETRY,
                () =>
            {
                VertexStructure structure = new VertexStructure();
                structure.FirstSurface.BuildRect4V(
                    new Vector3(-1f, -1f, 0f),
                    new Vector3(1f, -1f, 0f),
                    new Vector3(1f, 1f, 0f),
                    new Vector3(-1f, 1f, 0f),
                    Color4.Transparent);
                structure.FirstSurface.Material = KEY_MATERIAL;
                return(new GeometryResource(structure));
            });

            // Load the texture resource
            m_textureResource = resources.GetResourceAndEnsureLoaded <TextureResource>(m_texture);

            // Get default resources
            m_defaultResources = resources.GetResourceAndEnsureLoaded <DefaultResources>(
                DefaultResources.RESOURCE_KEY,
                () => new DefaultResources());

            m_renderParameters = resources.GetResourceAndEnsureLoaded <ObjectRenderParameters>(
                KEY_RENDER_PARAMETERS,
                () => new ObjectRenderParameters());
        }
        /// <summary>
        /// Loads all resources of this texture painter object.
        /// </summary>
        /// <param name="resources">The target resource dictionary.</param>
        internal void LoadResources(ResourceDictionary resources)
        {
            // Load material
            _materialResource = resources.GetResourceAndEnsureLoaded(
                _keyMaterial,
                () => new SpriteMaterialResource(_texture));

            // Load geometry resource
            _geometryResource = resources.GetResourceAndEnsureLoaded(
                _keyGeometry,
                () =>
            {
                var geometry = new Geometry();
                geometry.FirstSurface.BuildRect(
                    new Vector3(-1f, -1f, 0f),
                    new Vector3(1f, -1f, 0f),
                    new Vector3(1f, 1f, 0f),
                    new Vector3(-1f, 1f, 0f));
                return(new GeometryResource(geometry));
            });

            // Generate rendering chunks
            _renderingChunks = _geometryResource.BuildRenderingChunks(
                resources.Device, new MaterialResource[] { _materialResource });

            // Get default resources
            _defaultResources = resources.GetResourceAndEnsureLoaded(
                DefaultResources.RESOURCE_KEY,
                () => new DefaultResources());

            _renderParameters = resources.GetResourceAndEnsureLoaded(
                _keyRenderParameters,
                () => new ObjectRenderParameters());
        }
        /// <summary>
        /// Loads the resource.
        /// </summary>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            _vertexShader = resources.GetResourceAndEnsureLoaded(
                s_keyVertexShader,
                () => GraphicsHelper.Internals.GetVertexShaderResource(device, "LineRendering", "LineVertexShader"));
            _pixelShader = resources.GetResourceAndEnsureLoaded(
                s_keyPixelShader,
                () => GraphicsHelper.Internals.GetPixelShaderResource(device, "LineRendering", "LinePixelShader"));

            _inputLayout = device.DeviceD3D11_1.CreateInputLayout(
                LineVertex.InputElements, _vertexShader.ShaderBytecode);
        }
Esempio n. 6
0
        /// <summary>
        /// Loads the resource.
        /// </summary>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            // Load all required shaders and constant buffers
            m_vertexShader = resources.GetResourceAndEnsureLoaded(
                RES_KEY_VERTEX_SHADER,
                () => GraphicsHelper.GetVertexShaderResource(device, "Common", "SingleForcedColorVertexShader"));
            m_pixelShader = resources.GetResourceAndEnsureLoaded(
                RES_KEY_PIXEL_SHADER,
                () => GraphicsHelper.GetPixelShaderResource(device, "Common", "SingleForcedColorPixelShader"));

            m_cbPerMaterial = resources.GetResourceAndEnsureLoaded(
                KEY_CONSTANT_BUFFER,
                () => new TypeSafeConstantBufferResource <CBPerMaterial>());
            m_cbPerMaterialDataChanged = true;
        }
 /// <summary>
 /// Loads the resource.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="resources">Parent ResourceDictionary.</param>
 protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
 {
     m_defaultResources = resources.DefaultResources;
     m_vertexShader     = resources.GetResourceAndEnsureLoaded(
         RES_KEY_VERTEX_SHADER,
         () => GraphicsHelper.GetVertexShaderResource(device, "Postprocessing", "PostprocessVertexShader"));
 }
 /// <summary>
 /// Loads the resource.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="resources">Parent ResourceDictionary.</param>
 protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
 {
     _defaultResources = resources.DefaultResources;
     _vertexShader     = resources.GetResourceAndEnsureLoaded(
         s_resKeyVertexShader,
         () => GraphicsHelper.Internals.GetVertexShaderResource(device, "Postprocessing", "PostprocessVertexShader"));
 }
Esempio n. 9
0
        /// <summary>
        /// Gets the postrocess effect with the given key.
        /// </summary>
        /// <param name="namedOrGenericKey">The key of the effect.</param>
        /// <param name="resourceDictionary">The resource dictionary where to load the effect.</param>
        internal PostprocessEffectResource GetPostprocessEffect(NamedOrGenericKey namedOrGenericKey, ResourceDictionary resourceDictionary)
        {
            m_postprocessEffectKey = namedOrGenericKey;

            // Handle empty key
            if (namedOrGenericKey.IsEmpty)
            {
                m_postprocessEffect = null;
                return(null);
            }

            // Check for current effect object
            if (m_postprocessEffect != null)
            {
                // Good case, return current one
                if (m_postprocessEffect.Key == namedOrGenericKey)
                {
                    return(m_postprocessEffect);
                }

                // Bad case, effect has changed
                m_postprocessEffect = null;
            }

            m_postprocessEffect    = resourceDictionary.GetResourceAndEnsureLoaded <PostprocessEffectResource>(namedOrGenericKey);
            m_postprocessEffectKey = namedOrGenericKey;
            return(m_postprocessEffect);
        }
Esempio n. 10
0
 /// <summary>
 /// Loads all resources of the object.
 /// </summary>
 /// <param name="device">Current graphics device.</param>
 /// <param name="resourceDictionary">Current resource dicionary.</param>
 public override void LoadResources(EngineDevice device, ResourceDictionary resourceDictionary)
 {
     m_localResources.AddObject(
         resourceDictionary.GetResourceAndEnsureLoaded <GeometryResource>(m_resGeometryKey),
         device.DeviceIndex,
         false);
 }
Esempio n. 11
0
 /// <summary>
 /// Loads the resource.
 /// </summary>
 protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
 {
     _cbPerObject = resources.GetResourceAndEnsureLoaded(
         _keyConstantBuffer,
         () => new TypeSafeConstantBufferResource <CBPerObject>());
     NeedsRefresh = true;
 }
        /// <summary>
        /// Loads the resource.
        /// </summary>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            m_vertexShader = resources.GetResourceAndEnsureLoaded(
                KEY_VERTEX_SHADER,
                () => GraphicsHelper.GetVertexShaderResource(device, "LineRendering", "LineVertexShader"));
            m_pixelShader = resources.GetResourceAndEnsureLoaded(
                KEY_PIXEL_SHADER,
                () => GraphicsHelper.GetPixelShaderResource(device, "LineRendering", "LinePixelShader"));
            m_constantBuffer = resources.GetResourceAndEnsureLoaded(
                KEY_CONSTANT_BUFFER,
                () => new TypeSafeConstantBufferResource <ConstantBufferData>());

            m_inputLayout = new D3D11.InputLayout(
                device.DeviceD3D11_1,
                m_vertexShader.ShaderBytecode,
                LineVertex.InputElements);
        }
Esempio n. 13
0
 /// <summary>
 /// Loads all resources of the object.
 /// </summary>
 /// <param name="device">Current graphics device.</param>
 /// <param name="resourceDictionary">Current resource dicionary.</param>
 public override void LoadResources(EngineDevice device, ResourceDictionary resourceDictionary)
 {
     m_localResources.AddObject(
         resourceDictionary.GetResourceAndEnsureLoaded <LineRenderResources>(
             LineRenderResources.RESOURCE_KEY,
             () => new LineRenderResources()),
         device.DeviceIndex);
 }
        /// <summary>
        /// Loads the resource.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="resources">Parent ResourceDictionary.</param>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            base.LoadResourceInternal(device, resources);

            // Load graphics resources
            m_pixelShaderBlur = resources.GetResourceAndEnsureLoaded(
                RES_KEY_PIXEL_SHADER_BLUR,
                () => GraphicsHelper.GetPixelShaderResource(device, "Postprocessing", "PostprocessEdgeDetect"));
            m_renderTarget = resources.GetResourceAndEnsureLoaded <RenderTargetTextureResource>(
                KEY_RENDER_TARGET,
                () => new RenderTargetTextureResource(RenderTargetCreationMode.Color));
            m_defaultResources = resources.DefaultResources;

            // Load constant buffer
            m_constantBufferData = new CBPerObject();
            m_constantBuffer     = resources.GetResourceAndEnsureLoaded <TypeSafeConstantBufferResource <CBPerObject> >(
                KEY_CONSTANT_BUFFER,
                () => new TypeSafeConstantBufferResource <CBPerObject>(m_constantBufferData));
        }
        /// <summary>
        /// Loads the resource.
        /// </summary>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            //Load all required shaders and constant buffers
            m_vertexShader = resources.GetResourceAndEnsureLoaded(
                RES_KEY_VERTEX_SHADER,
                () => GraphicsHelper.GetVertexShaderResource(device, "Sprite", "SpriteVertexShader"));
            m_pixelShader = resources.GetResourceAndEnsureLoaded(
                RES_KEY_PIXEL_SHADER,
                () => GraphicsHelper.GetPixelShaderResource(device, "Sprite", "SpritePixelShader"));

            // Get a reference to default resource object
            m_defaultResources = resources.GetResourceAndEnsureLoaded <DefaultResources>(DefaultResources.RESOURCE_KEY);

            //Load the texture if any configured.
            if (!m_textureKey.IsEmpty)
            {
                //Get texture resource
                m_textureResource = resources.GetResourceAndEnsureLoaded <TextureResource>(m_textureKey);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Loads the resource.
        /// </summary>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            //Load all required shaders and constant buffers
            _vertexShader = resources.GetResourceAndEnsureLoaded(
                s_resKeyVertexShader,
                () => GraphicsHelper.Internals.GetVertexShaderResource(device, "Sprite", "SpriteVertexShader"));
            _pixelShader = resources.GetResourceAndEnsureLoaded(
                s_resKeyPixelShader,
                () => GraphicsHelper.Internals.GetPixelShaderResource(device, "Sprite", "SpritePixelShader"));

            // Get a reference to default resource object
            _defaultResources = resources.GetResourceAndEnsureLoaded <DefaultResources>(DefaultResources.RESOURCE_KEY);

            //Load the texture if any configured.
            if (!this.TextureKey.IsEmpty)
            {
                //Get texture resource
                _textureResource = resources.GetResourceAndEnsureLoaded <TextureResource>(this.TextureKey);
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Loads all resources of the object.
 /// </summary>
 /// <param name="device">Current graphics device.</param>
 /// <param name="resourceDictionary">Current resource dicionary.</param>
 public override void LoadResources(EngineDevice device, ResourceDictionary resourceDictionary)
 {
     m_localResources.AddObject(
         new LocalResourceData()
     {
         LineRenderResources = resourceDictionary.GetResourceAndEnsureLoaded <LineRenderResources>(
             LineRenderResources.RESOURCE_KEY,
             () => new LineRenderResources()),
         LineVertexBuffer = null
     },
         device.DeviceIndex);
 }
        /// <summary>
        /// Loads the resource.
        /// </summary>
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            // Load all required shaders and constant buffers
            m_vertexShader = resources.GetResourceAndEnsureLoaded(
                RES_KEY_VERTEX_SHADER,
                () => GraphicsHelper.GetVertexShaderResource(device, "Common", "CommonVertexShader"));
            m_pixelShader = resources.GetResourceAndEnsureLoaded(
                RES_KEY_PIXEL_SHADER,
                () => GraphicsHelper.GetPixelShaderResource(device, "Common", "CommonPixelShader"));
            m_cbPerMaterial = resources.GetResourceAndEnsureLoaded(
                KEY_CONSTANT_BUFFER,
                () => new TypeSafeConstantBufferResource <CBPerMaterial>());
            m_cbPerMaterialDataChanged = true;

            // Get a reference to default resource object
            m_defaultResources = resources.GetResourceAndEnsureLoaded <DefaultResources>(DefaultResources.RESOURCE_KEY);

            //Load the texture if any configured.
            if (!m_textureKey.IsEmpty)
            {
                //Get texture resource
                m_textureResource = resources.GetResourceAndEnsureLoaded <TextureResource>(m_textureKey);
            }
        }
Esempio n. 19
0
 /// <summary>
 /// Loads the resource.
 /// </summary>
 protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
 {
     m_cbPerObject = resources.GetResourceAndEnsureLoaded(
         KEY_CONSTANT_BUFFER,
         () => new TypeSafeConstantBufferResource <CBPerObject>());
 }
 /// <summary>
 /// Loads the resource.
 /// </summary>
 protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
 {
     _cbPerFrame = resources.GetResourceAndEnsureLoaded(
         _keyConstantBuffer,
         () => new TypeSafeConstantBufferResource <CBPerFrame>());
 }
Esempio n. 21
0
 public static MaterialResource GetOrCreateDefaultMaterialResource(this ResourceDictionary resourceDict)
 {
     return(resourceDict.GetResourceAndEnsureLoaded(
                ResourceKeys.RES_MATERIAL_COLORED,
                () => new StandardMaterialResource()));
 }
Esempio n. 22
0
        /// <summary>
        /// Loads all resources of the object.
        /// </summary>
        /// <param name="device">Current graphics device.</param>
        /// <param name="resourceDictionary">Current resource dictionary.</param>
        public override void LoadResources(EngineDevice device, ResourceDictionary resourceDictionary)
        {
            // Define all vertices
            StandardVertex[] CreateVertices()
            {
                return(new[] {
                    // Front side
                    new StandardVertex(new Vector3(-1f, +1f, -1f), new Vector2(0f, 0f)),
                    new StandardVertex(new Vector3(-1f, -1f, -1f), new Vector2(0f, 1f)),
                    new StandardVertex(new Vector3(+1f, -1f, -1f), new Vector2(1f, 1f)),
                    new StandardVertex(new Vector3(+1f, +1f, -1f), new Vector2(1f, 0f)),

                    // Right side
                    new StandardVertex(new Vector3(+1f, +1f, -1f), new Vector2(0f, 0f)),
                    new StandardVertex(new Vector3(+1f, -1f, -1f), new Vector2(0f, 1f)),
                    new StandardVertex(new Vector3(+1f, -1f, +1f), new Vector2(1f, 1f)),
                    new StandardVertex(new Vector3(+1f, +1f, +1f), new Vector2(1f, 0f)),

                    // Back side
                    new StandardVertex(new Vector3(+1f, +1f, +1f), new Vector2(0f, 0f)),
                    new StandardVertex(new Vector3(+1f, -1f, +1f), new Vector2(0f, 1f)),
                    new StandardVertex(new Vector3(-1f, -1f, +1f), new Vector2(1f, 1f)),
                    new StandardVertex(new Vector3(-1f, +1f, +1f), new Vector2(1f, 0f)),

                    // Left side
                    new StandardVertex(new Vector3(-1f, +1f, +1f), new Vector2(0f, 0f)),
                    new StandardVertex(new Vector3(-1f, -1f, +1f), new Vector2(0f, 1f)),
                    new StandardVertex(new Vector3(-1f, -1f, -1f), new Vector2(1f, 1f)),
                    new StandardVertex(new Vector3(-1f, +1f, -1f), new Vector2(1f, 0f)),

                    // Top side
                    new StandardVertex(new Vector3(-1f, +1f, +1f), new Vector2(0f, 0f)),
                    new StandardVertex(new Vector3(-1f, +1f, -1f), new Vector2(0f, 1f)),
                    new StandardVertex(new Vector3(+1f, +1f, -1f), new Vector2(1f, 1f)),
                    new StandardVertex(new Vector3(+1f, +1f, +1f), new Vector2(1f, 0f)),

                    // Down side
                    new StandardVertex(new Vector3(+1f, -1f, -1f), new Vector2(0f, 0f)),
                    new StandardVertex(new Vector3(-1f, -1f, -1f), new Vector2(1f, 0f)),
                    new StandardVertex(new Vector3(-1f, -1f, +1f), new Vector2(1f, 1f)),
                    new StandardVertex(new Vector3(+1f, -1f, +1f), new Vector2(0f, 1f))
                });
            }

            // Define all indices
            int[] CreateIndices()
            {
                return(new[]
                {
                    0, 1, 2, 2, 3, 0,       // Font side
                    4, 5, 6, 6, 7, 4,       // Right side
                    8, 9, 10, 10, 11, 8,    // Back side
                    12, 13, 14, 14, 15, 12, // Left side
                    16, 17, 18, 18, 19, 16, // Top side
                    20, 21, 22, 22, 23, 20  // Down side
                });
            }

            // Create and fill resource container object
            var localResources = new SkyboxLocalResources
            {
                CubeTexture  = resourceDictionary.GetResourceAndEnsureLoaded <TextureResource>(this.CubeTextureKey),
                VertexBuffer = resourceDictionary.GetResourceAndEnsureLoaded(
                    ResourceKeys.RES_SKYBOX_VERTICES,
                    () => new ImmutableVertexBufferResource <StandardVertex>(CreateVertices)),
                IndexBuffer = resourceDictionary.GetResourceAndEnsureLoaded(
                    ResourceKeys.RES_SKYBOX_INDICES,
                    () => new ImmutableIndexBufferResource(CreateIndices)),
                VertexShader = resourceDictionary.GetResourceAndEnsureLoaded(
                    ResourceKeys.RES_SKYBOX_VERTEX_SHADER,
                    () => GraphicsHelper.Internals.GetVertexShaderResource(device, "SkyBox", "CommonVertexShader")),
                PixelShader = resourceDictionary.GetResourceAndEnsureLoaded(
                    ResourceKeys.RES_SKYBOX_PIXEL_SHADER,
                    () => GraphicsHelper.Internals.GetPixelShaderResource(device, "SkyBox", "CommonPixelShader"))
            };

            // Store resource container object
            _localResources.AddObject(localResources, device.DeviceIndex);
        }
Esempio n. 23
0
        /// <summary>
        /// Loads all resources of the object.
        /// </summary>
        /// <param name="device">Current graphics device.</param>
        /// <param name="resourceDictionary">Current resource dicionary.</param>
        public override void LoadResources(EngineDevice device, ResourceDictionary resourceDictionary)
        {
            // Define all vertices
            StandardVertex[] vertices = new StandardVertex[]
            {
                // Front side
                new StandardVertex(new Vector3(-1f, +1f, -1f), new Vector2(0f, 0f)),
                new StandardVertex(new Vector3(-1f, -1f, -1f), new Vector2(0f, 1f)),
                new StandardVertex(new Vector3(+1f, -1f, -1f), new Vector2(1f, 1f)),
                new StandardVertex(new Vector3(+1f, +1f, -1f), new Vector2(1f, 0f)),

                // Right side
                new StandardVertex(new Vector3(+1f, +1f, -1f), new Vector2(0f, 0f)),
                new StandardVertex(new Vector3(+1f, -1f, -1f), new Vector2(0f, 1f)),
                new StandardVertex(new Vector3(+1f, -1f, +1f), new Vector2(1f, 1f)),
                new StandardVertex(new Vector3(+1f, +1f, +1f), new Vector2(1f, 0f)),

                // Back side
                new StandardVertex(new Vector3(+1f, +1f, +1f), new Vector2(0f, 0f)),
                new StandardVertex(new Vector3(+1f, -1f, +1f), new Vector2(0f, 1f)),
                new StandardVertex(new Vector3(-1f, -1f, +1f), new Vector2(1f, 1f)),
                new StandardVertex(new Vector3(-1f, +1f, +1f), new Vector2(1f, 0f)),

                // Left side
                new StandardVertex(new Vector3(-1f, +1f, +1f), new Vector2(0f, 0f)),
                new StandardVertex(new Vector3(-1f, -1f, +1f), new Vector2(0f, 1f)),
                new StandardVertex(new Vector3(-1f, -1f, -1f), new Vector2(1f, 1f)),
                new StandardVertex(new Vector3(-1f, +1f, -1f), new Vector2(1f, 0f)),

                // Top side
                new StandardVertex(new Vector3(-1f, +1f, +1f), new Vector2(0f, 0f)),
                new StandardVertex(new Vector3(-1f, +1f, -1f), new Vector2(0f, 1f)),
                new StandardVertex(new Vector3(+1f, +1f, -1f), new Vector2(1f, 1f)),
                new StandardVertex(new Vector3(+1f, +1f, +1f), new Vector2(1f, 0f)),

                // Down side
                new StandardVertex(new Vector3(+1f, -1f, -1f), new Vector2(0f, 0f)),
                new StandardVertex(new Vector3(-1f, -1f, -1f), new Vector2(1f, 0f)),
                new StandardVertex(new Vector3(-1f, -1f, +1f), new Vector2(1f, 1f)),
                new StandardVertex(new Vector3(+1f, -1f, +1f), new Vector2(0f, 1f)),
            };

            // Define all indices
            int[] indices = new int[]
            {
                0, 1, 2, 2, 3, 0,        // Font side
                4, 5, 6, 6, 7, 4,        // Right side
                8, 9, 10, 10, 11, 8,     // Back side
                12, 13, 14, 14, 15, 12,  // Left side
                16, 17, 18, 18, 19, 16,  // Top side
                20, 21, 22, 22, 23, 20   // Down side
            };

            // Create and fill resource container object
            SkyboxLocalResources localResources = new SkyboxLocalResources();

            localResources.DefaultResources = resourceDictionary.DefaultResources;
            localResources.CubeTexture      = resourceDictionary.GetResourceAndEnsureLoaded <TextureResource>(m_cubeTextureKey);
            localResources.VertexBuffer     = GraphicsHelper.CreateImmutableVertexBuffer(device, vertices);
            localResources.IndexBuffer      = GraphicsHelper.CreateImmutableIndexBuffer(device, indices);
            localResources.VertexShader     = resourceDictionary.GetResourceAndEnsureLoaded(
                ResourceKeys.RES_VERTEX_SHADER_SKYBOX,
                () => GraphicsHelper.GetVertexShaderResource(device, "Skybox", "CommonVertexShader"));
            localResources.PixelShader = resourceDictionary.GetResourceAndEnsureLoaded(
                ResourceKeys.RES_PIXEL_SHADER_SKYBOX,
                () => GraphicsHelper.GetPixelShaderResource(device, "Skybox", "CommonPixelShader"));

            // Store resource container object
            m_localResources.AddObject(localResources, device.DeviceIndex);
        }