AddMeshes() private method

private AddMeshes ( Renderer renderer, string path, ValveResourceFormat.Package package ) : void
renderer GUI.Types.Renderer.Renderer
path string
package ValveResourceFormat.Package
return void
コード例 #1
0
        internal void AddObjects(Renderer.Renderer renderer, string path, Package package)
        {
            var data = Resource.Blocks[BlockType.DATA] as NTRO;

            // Output is World_t we need to iterate m_worldNodes inside it.
            var worldNodes = (NTROArray)data.Output["m_worldNodes"];

            if (worldNodes.Count > 0)
            {
                var nodeData = ((NTROValue <NTROStruct>)worldNodes[0]).Value; //TODO: Not be 0.

                var worldNode = ((NTROValue <string>)nodeData["m_worldNodePrefix"]).Value;
                if (worldNode != null)
                {
                    var newResource = FileExtensions.LoadFileByAnyMeansNecessary(worldNode + ".vwnod_c", path, package);
                    if (newResource == null)
                    {
                        Console.WriteLine("unable to load model " + worldNode + ".vwnod_c");
                        throw new Exception("WTF");
                    }

                    var node = new WorldNode(newResource);
                    node.AddMeshes(renderer, path, package);
                }
            }

            var entityLumps = (NTROArray)data.Output["m_entityLumps"];

            foreach (var lump in entityLumps)
            {
                LoadEntities(lump, renderer, path, package);
            }
        }
コード例 #2
0
        internal void AddObjects(Renderer.Renderer renderer, string path, Package package)
        {
            var data = Resource.Blocks[BlockType.DATA] as NTRO;

            // Output is World_t we need to iterate m_worldNodes inside it.
            var worldNodes = (NTROArray)data.Output["m_worldNodes"];
            if (worldNodes.Count > 0)
            {
                var nodeData = ((NTROValue<NTROStruct>)worldNodes[0]).Value; //TODO: Not be 0.

                var worldNode = ((NTROValue<string>)nodeData["m_worldNodePrefix"]).Value;
                if (worldNode != null)
                {
                    var newResource = FileExtensions.LoadFileByAnyMeansNecessary(worldNode + ".vwnod_c", path, package);
                    if (newResource == null)
                    {
                        Console.WriteLine("unable to load model " + worldNode + ".vwnod_c");
                        throw new Exception("WTF");
                    }

                    var node = new WorldNode(newResource);
                    node.AddMeshes(renderer, path, package);
                }
            }

            var entityLumps = (NTROArray)data.Output["m_entityLumps"];
            foreach (var lump in entityLumps)
            {
                LoadEntities(lump, renderer, path, package);
            }
        }