コード例 #1
0
        private void AddNodeGroup <T>(ResDict <T> SubSections, BCRESGroupNode Folder)
            where T : CtrObject, new()
        {
            if (SubSections == null || SubSections.Count == 0)
            {
                return;
            }

            Nodes.Add(Folder);

            foreach (CtrObject section in SubSections.Values)
            {
                switch (Folder.Type)
                {
                case BCRESGroupType.Models:
                    var CMDLWrapper = new CMDLWrapper((Model)section, this);
                    Folder.AddNode(CMDLWrapper);
                    RenderedBcres.Models.Add(CMDLWrapper);
                    break;

                case BCRESGroupType.Textures:
                    var wrapper = new TXOBWrapper((Texture)section, this);
                    Folder.AddNode(wrapper);
                    Textures.Add(wrapper);
                    PluginRuntime.bcresTexContainers.Add(Folder);
                    break;
                }
            }
        }
コード例 #2
0
        public static int BindTexture(STGenericMatTexture tex)
        {
            GL.ActiveTexture(TextureUnit.Texture0 + tex.textureUnit + 1);
            GL.BindTexture(TextureTarget.Texture2D, RenderTools.defaultTex.RenderableTex.TexID);

            string activeTex = tex.Name;

            foreach (var bcresTexContainer in PluginRuntime.bcresTexContainers)
            {
                if (bcresTexContainer.ResourceNodes.ContainsKey(activeTex))
                {
                    TXOBWrapper txob = (TXOBWrapper)bcresTexContainer.ResourceNodes[activeTex];

                    if (txob.RenderableTex == null || !txob.RenderableTex.GLInitialized)
                    {
                        txob.LoadOpenGLTexture();
                    }

                    BindGLTexture(tex, txob.RenderableTex.TexID);
                    break;
                }
            }
            return(tex.textureUnit + 1);
        }