예제 #1
0
        internal void Initialize()
        {
            PlatformInitialize();

            // Force set the default render states.
            _blendStateDirty  = _depthStencilStateDirty = _rasterizerStateDirty = true;
            BlendState        = BlendState.Opaque;
            DepthStencilState = DepthStencilState.Default;
            RasterizerState   = RasterizerState.CullCounterClockwise;

            // Clear the texture and sampler collections forcing
            // the state to be reapplied.
            VertexTextures.Clear();
            VertexSamplerStates.Clear();
            Textures.Clear();
            SamplerStates.Clear();

            // Clear constant buffers
            _vertexConstantBuffers.Clear();
            _pixelConstantBuffers.Clear();

            // Force set the buffers and shaders on next ApplyState() call
            _indexBufferDirty  = true;
            _vertexBufferDirty = true;
            _vertexShaderDirty = true;
            _pixelShaderDirty  = true;

            // Set the default scissor rect.
            _scissorRectangleDirty = true;
            ScissorRectangle       = _viewport.Bounds;

            // Set the default render target.
            ApplyRenderTargets(null);
        }
예제 #2
0
 public void ClearResources()
 {
     Textures.Clear();
     Fonts.Clear();
     SoundBuffers.Clear();
     Sounds.Clear();
 }
예제 #3
0
        internal void Initialize()
        {
            PlatformInitialize();

            // Clear the texture and sampler collections forcing
            // the state to be reapplied.
            VertexTextures.Clear();
            VertexSamplerStates.Clear();
            Textures.Clear();
            SamplerStates.Clear();

            // Clear constant buffers
            _vertexConstantBuffers.Clear();
            _pixelConstantBuffers.Clear();

            // Force set the buffers and shaders on next ApplyState() call
            _vertexBuffers = new VertexBufferBindings(_maxVertexBufferSlots);
            //            _vertexBuffersDirty = true;
            _indexBufferDirty  = true;
            _vertexShaderDirty = true;
            _pixelShaderDirty  = true;

            // Set the default scissor rect.
            _scissorRectangleDirty = true;
            ScissorRectangle       = _viewport.Bounds;

            // Set the default render target.
            ApplyRenderTargets(null);
        }
예제 #4
0
파일: Tdb.cs 프로젝트: GMMan/libdgf
        public void Read(BinaryReader br)
        {
            var startPos = br.BaseStream.Position;

            Flags = (TdbFlags)br.ReadByte();
            Textures.Clear();
            byte numTextures = br.ReadByte();

            for (int i = 0; i < numTextures; ++i)
            {
                var tex = new TdbTexture();
                tex.Read(br);
                Textures.Add(tex);
            }
            var read    = br.BaseStream.Position - startPos;
            var aligned = (read + 15) & ~15;

            br.BaseStream.Seek(aligned - read, SeekOrigin.Current);

            if ((Flags & TdbFlags.SkipBoundingBox) == 0)
            {
                BoundingBox = br.ReadBoundingBox();
            }

            Mesh = new Db2();
            Mesh.Read(br);
        }
예제 #5
0
        public override void ReadMetadata(BinaryReader stream, int totalSize)
        {
            var version = stream.ReadUInt32();

            BillboardGuid = stream.ReadGuid();
            var subVersion = stream.ReadUInt32();

            UnknownUint1      = stream.ReadUInt32();
            Flags             = stream.ReadStringList();
            UnknownUint2      = stream.ReadUInt32();
            VertexLayoutFlags = stream.ReadStringList();
            BlendMode         = stream.ReadSizedString();
            Shader            = new AssetDependence <Shader>(stream.ReadGuid());
            var texCount = stream.ReadInt32();

            Textures.Clear();
            for (int i = 0; i < texCount; i++)
            {
                var index   = stream.ReadInt32();
                var texGuid = stream.ReadGuid();
                Textures[index] = new AssetDependence <Texture>(texGuid);
            }

            AlphaTest           = stream.ReadSingle();
            ShaderMaterialFlags = stream.ReadStringList();
            ExtraMaterialSettings.Load(stream, subVersion);
        }
예제 #6
0
        internal void Initialize()
        {
            _renderState.BlendState      = BlendState.Opaque;
            _renderState.RasterizerState = RasterizerState.CullCounterClockwise;

            Textures.Clear();
        }
예제 #7
0
        //Filtering Materials
        private void tbFilter_TextChanged(object sender, EventArgs e)
        {
            filterword = tbFilter.Text;
            count      = filterword.Length;

            if (count > 1)
            {
                filterword = char.ToUpper(filterword[0]) + filterword.Substring(1);
            }


            count = Materials.IndexOf(filterword);
            switch (count)
            {
            case -1:
                pictureBox1.Image = null;
                lbOptions.Items.Clear();
                populateMaterials();
                break;

            default:
                lbMaterials.Items.Clear();
                lbMaterials.Items.Add(Materials[count]);

                Textures.Clear();
                CurrentMaterial   = Materials[count];
                CurrentPath       = TexturePath + "\\" + CurrentMaterial;
                pictureBox1.Image = null;
                loadTextures();
                break;
            }
        }
예제 #8
0
파일: NonPC.cs 프로젝트: semirs1991/CellAO
        // New one with id AND playfield as filter
        public new void readTexturesfromSQL()
        {
            SqlWrapper ms = new SqlWrapper();
            AOTextures m_tex;

            Textures.Clear();

            DataTable dt = ms.ReadDT("SELECT textures0, textures1, textures2, textures3, textures4 from " + getSQLTablefromDynelType() + " WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());

            if (dt.Rows.Count > 0)
            {
                m_tex = new AOTextures(0, (Int32)dt.Rows[0]["textures0"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(1, (Int32)dt.Rows[0]["textures1"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(2, (Int32)dt.Rows[0]["textures2"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(3, (Int32)dt.Rows[0]["textures3"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(4, (Int32)dt.Rows[0]["textures4"]);
                Textures.Add(m_tex);
            }
        }
예제 #9
0
파일: remEditor.cs 프로젝트: kkdevs/sb3u
        public void InitTextures(bool allTextures, bool noMaskFilter)
        {
            Textures.Clear();
            String texDir = allTextures ? rem.TexturePathFromREM(Parser.RemPath) : null;

            if (allTextures && texDir != null)
            {
                DirectoryInfo dir = new DirectoryInfo(texDir);
                foreach (FileInfo file in dir.EnumerateFiles())
                {
                    string fileName = file.Name.ToLower();
                    if (!noMaskFilter || !fileName.Contains("_mask") && !fileName.Contains("_shade"))
                    {
                        Textures.Add(file.Name);
                    }
                }
            }
            else
            {
                foreach (remMaterial mat in Parser.MATC)
                {
                    if (mat.texture != null && !Textures.Contains(mat.texture))
                    {
                        Textures.Add(mat.texture);
                    }
                }
            }
        }
예제 #10
0
 public void Clear()
 {
     TimeSource.Clear();
     Shaders.Clear();
     Textures.Clear();
     uniforms.Clear();
     ShaderKeyframes.Clear();
 }
예제 #11
0
 private void lbMaterials_SelectedIndexChanged(object sender, EventArgs e)
 {
     Textures.Clear();
     CurrentMaterial   = lbMaterials.SelectedItem.ToString();
     CurrentPath       = TexturePath + "\\" + CurrentMaterial;
     pictureBox1.Image = null;
     loadTextures();
 }
예제 #12
0
        /*public static void UpdateAudioBuffers(double time)
         * {
         *      foreach (KeyValuePair<string, AudioBuffer> pair in Audio)
         *      {
         *              pair.Value.Update(time);
         *      }
         * }
         *
         * public static void StopAllAudio()
         * {
         *      foreach (KeyValuePair<string, AudioBuffer> pair in Audio)
         *      {
         *              pair.Value.Stop();
         *              pair.Value.Looping = false;
         *      }
         * }*/

        public static void UnloadTextures()
        {
            foreach (KeyValuePair <string, Texture> pair in Textures)
            {
                pair.Value.Unload();
            }

            Textures.Clear();
        }
 public void Reset()
 {
     Textures.Clear();
     Indices.Clear();
     Vertices.Clear();
     RenderBatches.Clear();
     OptimizedDraws.Clear();
     UnknownShorts1.Clear();
     UnknownVectors1.Clear();
     TileOccluderInfos.Clear();
 }
예제 #14
0
 void Clear()
 {
     foreach (var texturesValue in Textures.Values)
     {
         ((Texture2D)texturesValue).Dispose();
     }
     Textures.Clear();
     Sounds.Clear();
     Fonts.Clear();
     Music.Clear();
     MonoContentManager.Unload();
 }
예제 #15
0
        // MAIN LOAD METHOD
        public void Load(ContentManager content)
        {
            OnStartLoad(EventArgs.Empty);

            LoadingProgress = 0f;
            IsLoaded        = false;
            IsLoading       = true;
            Textures.Clear();

            Thread loadThread = new Thread(() => LoadOnOtherThread(content));

            loadThread.Start();
        }
예제 #16
0
파일: odfEditor.cs 프로젝트: kkdevs/sb3u
 public void Dispose()
 {
     Frames.Clear();
     if (Materials != null)
     {
         Materials.Clear();
     }
     if (Textures != null)
     {
         Textures.Clear();
     }
     Parser = null;
 }
예제 #17
0
        public void Dispose()
        {
            if (_file != null)
            {
                _file.Dispose();
            }

            foreach (var texture in this)
            {
                texture.Dispose();
            }

            Textures.Clear();
        }
예제 #18
0
파일: MapChunk.cs 프로젝트: veserine/Neo
        protected virtual void Dispose(bool disposing)
        {
            if (Textures != null)
            {
                Textures.Clear();
                Textures = null;
            }

            Vertices         = null;
            AlphaValues      = null;
            HoleValues       = null;
            TextureScales    = null;
            DoodadReferences = null;
            Parent           = null;
        }
예제 #19
0
        /// <summary>
        /// Configures <see cref="Devices"/> and <see cref="Textures"/> from <see cref="Ids"/>.
        /// </summary>
        public void Configure()
        {
            IsStarted    = false;
            IsConfigured = true;

            Devices.Clear();
            Textures.Clear();
            Textures2D.Clear();

            foreach (int webcamId in Ids)
            {
                var webcamDevice = WebCamTexture.devices[webcamId];
                Devices.Add(webcamDevice);
                Textures.Add(new WebCamTexture(webcamDevice.name));
            }
        }
예제 #20
0
        public override void Dispose()
        {
            Console.WriteLine("Disposing " + this.Name);

            foreach (BfresModelAsset model in Models)
            {
                model.Destroy();
            }
            foreach (var tex in Textures.Values)
            {
                tex.RenderableTex?.Dispose();
            }

            Models.Clear();
            Textures.Clear();
        }
예제 #21
0
파일: Data.cs 프로젝트: iulian204/HedgeLib
        public static void Clear()
        {
            // Clear Resource Directories
            ModelDirectories.Clear();
            ResourceDirectories.Clear();

            // Clear Viewport Models/Instances
            Viewport.SelectedInstances.Clear();
            DefaultCube.Instances.Clear();
            DefaultTerrainGroup.Clear();
            TerrainGroups.Clear();
            Objects.Clear();

            // Clear Resources
            Materials.Clear();
            Textures.Clear();
        }
예제 #22
0
파일: SpartaGame.cs 프로젝트: tvalle/Sparta
        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            Textures.Clear();
            Fonts.Clear();
            SoundEffects.Clear();
            Songs.Clear();

            ContentManager.Unload();
#if DEBUG
            SpartaDebug.DebugFont = null;
#endif
            backgroundImage = null;

            base.UnloadContent();

            GC.Collect();
        }
예제 #23
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         TextureThreadContextReady.Close();
         Printer.Dispose();
         PendingTextures.Close();
         Prims.Clear();
         Textures.Clear();
         glControl.Context.Dispose();
         glControl.Dispose();
         renderer = null;
         GLMode   = null;
         components.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #24
0
        public void Purge(Game game)
        {
            Textures.Clear();
            Texture2Ds.Clear();
            Texture3Ds.Clear();
            Models.Clear();
            Effects.Clear();
            Fonts.Clear();

            Textures   = new List <ContentResource <Texture> >();
            Texture2Ds = new List <ContentResource <Texture2D> >();
            Texture3Ds = new List <ContentResource <Texture3D> >();
            Models     = new List <ContentResource <Model> >();
            Effects    = new List <ContentResource <Effect> >();
            Fonts      = new List <ContentResource <SpriteFont> >();

            game.Content.Unload();
        }
예제 #25
0
        // Methods

        /// <summary>
        /// Configures <see cref="Devices"/> and <see cref="Textures"/> from <see cref="Ids"/>.
        /// </summary>
        public void Configure()
        {
            IsStarted    = false;
            IsConfigured = true;

            Devices.Clear();
            Textures.Clear();
            Textures2D.Clear();

            print("Configuring webcam...");
            foreach (var webcamId in Ids)
            {
                var webcamDevice = WebCamTexture.devices[webcamId];
                Devices.Add(webcamDevice);
                //Textures.Add(new WebCamTexture(webcamDevice.name));
                //HACK: pass in our webcam
                Textures.Add(CamFeed.Instance.GetWebCamTexture());
            }
        }
예제 #26
0
파일: NonPC.cs 프로젝트: semirs1991/CellAO
        // New one with id AND playfield as filter
        public void readTexturesfromSQLfast(DataRow row)
        {
            Textures.Clear();
            AOTextures m_tex;

            m_tex = new AOTextures(0, (Int32)row["textures0"]);
            Textures.Add(m_tex);

            m_tex = new AOTextures(1, (Int32)row["textures1"]);
            Textures.Add(m_tex);

            m_tex = new AOTextures(2, (Int32)row["textures2"]);
            Textures.Add(m_tex);

            m_tex = new AOTextures(3, (Int32)row["textures3"]);
            Textures.Add(m_tex);

            m_tex = new AOTextures(4, (Int32)row["textures4"]);
            Textures.Add(m_tex);
        }
예제 #27
0
        private void LoadAnim(MaterialAnim anim)
        {
            Initialize();

            MaterialAnim = anim;
            FrameCount   = MaterialAnim.FrameCount;
            Text         = anim.Name;

            Textures.Clear();
            if (anim.TextureNames != null)
            {
                foreach (var name in anim.TextureNames)
                {
                    Textures.Add(name);
                }
            }

            Materials.Clear();
            foreach (var matanim in anim.MaterialAnimDataList)
            {
                var mat = new MaterialAnimEntry(matanim.Name);
                mat.MaterialAnimData = matanim;
                Materials.Add(mat);

                foreach (var param in matanim.ParamAnimInfos)
                {
                    FSHU.BfresParamAnim paramInfo = new FSHU.BfresParamAnim(param.Name);
                    mat.Params.Add(paramInfo);

                    paramInfo.Type = AnimationType.ShaderParam;

                    //There is no better way to determine if the param is a color type afaik
                    if (param.Name.Contains("Color") || param.Name.Contains("color") || param.Name == "multi_tex_reg2")
                    {
                        paramInfo.Type = AnimationType.Color;
                    }
                    else if (AnimType == AnimationType.TexturePattern)
                    {
                        paramInfo.Type = AnimationType.TexturePattern;
                    }
                    else if (AnimType == AnimationType.TextureSrt)
                    {
                        paramInfo.Type = AnimationType.TextureSrt;
                    }
                    else
                    {
                        paramInfo.Type = AnimationType.ShaderParam;
                    }

                    //Get constant anims
                    for (int constant = 0; constant < param.ConstantCount; constant++)
                    {
                        int index = constant + param.BeginConstant;

                        Animation.KeyGroup keyGroup = new Animation.KeyGroup();
                        keyGroup.Keys.Add(new Animation.KeyFrame()
                        {
                            InterType = InterpolationType.CONSTANT,
                            Frame     = 0,
                            Value     = matanim.Constants[index].Value,
                        });

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = matanim.Constants[index].AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }

                    for (int curve = 0; curve < param.FloatCurveCount + param.IntCurveCount; curve++)
                    {
                        int index = curve + param.BeginCurve;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrack(matanim.Curves[index]);
                        keyGroup.AnimDataOffset = matanim.Curves[index].AnimDataOffset;

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = keyGroup.AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }
                }

                foreach (TexturePatternAnimInfo SamplerInfo in matanim.TexturePatternAnimInfos)
                {
                    BfresSamplerAnim sampler = new BfresSamplerAnim(SamplerInfo.Name, this, mat);
                    mat.Samplers.Add(sampler);


                    int textureIndex = 0;

                    if (SamplerInfo.BeginConstant != 65535)
                    {
                        textureIndex = matanim.Constants[SamplerInfo.BeginConstant].Value;

                        sampler.Keys.Add(new Animation.KeyFrame()
                        {
                            Frame = 0, Value = textureIndex
                        });
                        sampler.Constant       = true;
                        sampler.AnimDataOffset = matanim.Constants[SamplerInfo.BeginConstant].AnimDataOffset;
                    }
                    if (SamplerInfo.CurveIndex != 65535)
                    {
                        int index = (int)SamplerInfo.CurveIndex;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrack(matanim.Curves[index]);

                        sampler.AnimDataOffset = matanim.Curves[index].AnimDataOffset;
                        sampler.Keys           = keyGroup.Keys;
                    }
                }
            }
        }
예제 #28
0
        private void LoadAnim(TexPatternAnim anim)
        {
            CanReplace = true;
            CanExport  = true;
            CanDelete  = true;
            CanRename  = true;

            Text = anim.Name;

            TexPatternAnim = anim;
            FrameCount     = anim.FrameCount;

            Materials.Clear();
            Textures.Clear();
            if (anim.TextureRefNames != null)
            {
                foreach (var tex in anim.TextureRefNames)
                {
                    Textures.Add(tex.Name);
                }
            }

            if (anim.TextureRefs != null)
            {
                foreach (var tex in anim.TextureRefs)
                {
                    Textures.Add(tex.Key);
                }
            }


            foreach (TexPatternMatAnim matanim in anim.TexPatternMatAnims)
            {
                var mat = new MaterialAnimEntry(matanim.Name);
                mat.TexPatternMatAnim = matanim;
                Materials.Add(mat);

                foreach (PatternAnimInfo SamplerInfo in matanim.PatternAnimInfos)
                {
                    BfresSamplerAnim sampler = new BfresSamplerAnim(SamplerInfo.Name, this);
                    mat.Samplers.Add(sampler);

                    int textureIndex = 0;

                    if (SamplerInfo.SubBindIndex != -1)
                    {
                        textureIndex = SamplerInfo.SubBindIndex;

                        sampler.Keys.Add(new Animation.KeyFrame()
                        {
                            Frame = 0, Value = textureIndex
                        });
                        sampler.Constant = true;
                    }
                    if (SamplerInfo.CurveIndex != -1)
                    {
                        int index = (int)SamplerInfo.CurveIndex;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrackWiiU(matanim.Curves[index]);
                        sampler.AnimDataOffset = matanim.Curves[index].AnimDataOffset;
                        sampler.Keys           = keyGroup.Keys;

                        foreach (var ind in keyGroup.Keys)
                        {
                            Console.WriteLine($"{SamplerInfo.Name} {ind.Value}");
                        }
                    }
                }
            }
        }
예제 #29
0
파일: Model.cs 프로젝트: vaulthunter/sledge
        /// <summary>
        /// Combines the textures in this model into one bitmap and modifies all the referenced skins and texture coordinates to use the combined texture.
        /// This modifies the model object.
        /// </summary>
        private void CombineTextures()
        {
            if (!Textures.Any())
            {
                return;
            }
            // Calculate the dimension of the combined texture
            var width      = 0;
            var height     = 0;
            var heightList = new Dictionary <int, int>();

            foreach (var texture in Textures)
            {
                width = Math.Max(texture.Width, width);
                heightList.Add(texture.Index, height);
                height += texture.Height;
            }

            // Create the combined texture and draw all the textures onto it
            var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);

            using (var g = Graphics.FromImage(bmp))
            {
                var y = 0;
                foreach (var texture in Textures)
                {
                    g.DrawImage(texture.Image, 0, y);
                    y += texture.Height;
                }
            }

            // Create the texture object and replace the existing textures
            var tex = new Texture
            {
                Flags  = Textures[0].Flags,
                Height = height,
                Width  = width,
                Image  = bmp,
                Index  = 0,
                Name   = "Combined Texture"
            };

            foreach (var texture in Textures)
            {
                texture.Image.Dispose();
            }
            Textures.Clear();
            Textures.Insert(0, tex);

            // Update all the meshes with the new texture and alter the texture coordinates as needed
            foreach (var mesh in GetActiveMeshes())
            {
                if (!heightList.ContainsKey(mesh.SkinRef))
                {
                    mesh.SkinRef = -1;
                    continue;
                }
                var i    = mesh.SkinRef;
                var yVal = heightList[i];
                foreach (var v in mesh.Vertices)
                {
                    v.TextureV += yVal;
                }
                mesh.SkinRef = 0;
            }
            // Reset the texture indices
            for (var i = 0; i < Textures.Count; i++)
            {
                Textures[i].Index = i;
            }
        }
예제 #30
0
 /// <summary>
 /// Clears all spawn points, textures and tiles.
 /// </summary>
 public void Clear()
 {
     SpawnPoints.Clear();
     Textures.Clear();
     Tiles.Clear();
 }