Ejemplo n.º 1
0
        private void RecreateTexture()
        {
            _deviceTexture.Dispose();
            _textureBinding.Dispose();

            _texture        = _textureRef.Get(_ad);
            _deviceTexture  = _texture.CreateDeviceTexture(_gs.Context.ResourceFactory);
            _textureBinding = _gs.Context.ResourceFactory.CreateShaderTextureBinding(_deviceTexture);
        }
Ejemplo n.º 2
0
        private void RecreateModel()
        {
            //_vb.Dispose();
            //_ib.Dispose();

            _mesh = _meshRef.Get(_ad);
            _vb   = _mesh.CreateVertexBuffer(_gs.Context.ResourceFactory);
            CreateIndexBuffer(_isTransparent);
            _centeredBoundingSphere = _mesh.GetBoundingSphere();
            _centeredBoundingBox    = _mesh.GetBoundingBox();
        }
Ejemplo n.º 3
0
Archivo: Skybox.cs Proyecto: zhuowp/ge
        private void RecreateCubemapTexture()
        {
            AssetDatabase   ad      = _as.Database;
            ResourceFactory factory = _gs.Context.ResourceFactory;

            _cubemapBinding?.BoundTexture.Dispose();
            _cubemapBinding?.Dispose();

            var front  = !_front.HasValue ? _front.Get(ad) : ad.LoadAsset <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxFrontID);
            var back   = !_back.HasValue ? _back.Get(ad) : ad.LoadAsset <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxBackID);
            var left   = !_left.HasValue ? _left.Get(ad) : ad.LoadAsset <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxLeftID);
            var right  = !_right.HasValue ? _right.Get(ad) : ad.LoadAsset <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxRightID);
            var top    = !_top.HasValue ? _top.Get(ad) : ad.LoadAsset <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxTopID);
            var bottom = !_bottom.HasValue ? _bottom.Get(ad) : ad.LoadAsset <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxBottomID);

            using (var frontPin = front.Pixels.Pin())
                using (var backPin = back.Pixels.Pin())
                    using (var leftPin = left.Pixels.Pin())
                        using (var rightPin = right.Pixels.Pin())
                            using (var topPin = top.Pixels.Pin())
                                using (var bottomPin = bottom.Pixels.Pin())
                                {
                                    var cubemapTexture = factory.CreateCubemapTexture(
                                        frontPin.Ptr,
                                        backPin.Ptr,
                                        leftPin.Ptr,
                                        rightPin.Ptr,
                                        topPin.Ptr,
                                        bottomPin.Ptr,
                                        front.Width,
                                        front.Height,
                                        front.PixelSizeInBytes,
                                        front.Format);
                                    _cubemapBinding = factory.CreateShaderTextureBinding(cubemapTexture);
                                }
        }