Example #1
0
        public static void loadShaders(String[] urls)
        {
            for (int i = 0; i < urls.Length; ++i)
            {
                urls[i] = Config.q3bsp_base_folder + '/' + urls[i];
            }

            ShaderParser.loadList(urls, (List <shader_t> shaders) =>
            {
                BspOpenglBuilders.buildShaders(shaders);
            });
        }
Example #2
0
        public static void onMessage(MessageParams msg)
        {
            //if(msg.data is String) return;

            string type = msg.type;

            switch (type)
            {
            case "entities":
                entities = msg.entities;
                processEntities(entities);
                break;

            case "geometry":
                BspOpenglBuilders.buildBuffers(msg.vertices, msg.indices);
                surfaces = msg.surfaces;
                bindShaders();     // compiles in another thread
                break;

            case "lightmap":
                BspOpenglBuilders.buildLightmaps(msg.size, msg.lightmaps);
                break;

            case "shaders":
                BspOpenglBuilders.buildShaders(msg.shaders);
                break;

            case "bsp":
                bspTree = new q3bsptree(msg.bsp);
                if (onbsp != null)
                {
                    onbsp(bspTree);
                }
                //clearLoadStatus();
                break;

            case "visibility":
                setVisibility(msg.visibleSurfaces);
                break;

            case "status":
                Console.WriteLine(msg.message);
                //onLoadStatus(msg.message);
                break;

            default:
                throw new Exception("Unexpected message type: " + msg.type);
            }
        }