Exemple #1
0
        public q3bsp()
        {
            //map = this;
            glshading = new ShaderCompiler();

            //showLoadStatus();

            // Map elements
            skybox_env = null;

            vertexBuffer = -1;
            indexBuffer  = -1;
            indexCount   = 0;
            lightmap     = glshading.createSolidTexture(new Vector4(255, 255, 255, 255));
            surfaces     = null;
            shaders      = new Dictionary <string, shader_gl>();

            highlighted = null;

            // Sorted draw elements
            unshadedSurfaces = new List <shader_p>();
            defaultSurfaces  = new List <shader_p>();
            modelSurfaces    = new List <shader_p>();
            effectSurfaces   = new List <shader_p>();

            // BSP Elements
            bspTree = null;

            // Effect elements
            startTime = (int)DateTime.Now.Ticks;
            bgMusic   = null;
        }
Exemple #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);
            }
        }