Exemplo n.º 1
0
        private void EmitSurface(GuiModelSurface surface, Matrix modelMatrix, Matrix modelViewMatrix, bool depthHack)
        {
            if (surface.VertexCount == 0)
            {
                // nothing in the surface
                return;
            }

            // copy verts and indexes
            Surface tri = new Surface();

            tri.Indexes  = new int[surface.IndexCount];
            tri.Vertices = new Vertex[surface.VertexCount];

            _indexes.CopyTo(surface.FirstIndex, tri.Indexes, 0, surface.IndexCount);

            // we might be able to avoid copying these and just let them reference the list vars
            // but some things, like deforms and recursive
            // guis, need to access the verts in cpu space, not just through the vertex range
            _vertices.CopyTo(surface.FirstVertex, tri.Vertices, 0, surface.VertexCount);

            // move the verts to the vertex cache
            tri.AmbientCache = idE.RenderSystem.AllocateVertexCacheFrameTemporary(tri.Vertices);

            // if we are out of vertex cache, don't create the surface
            if (tri.AmbientCache == null)
            {
                return;
            }

            RenderEntityComponent renderEntity = new RenderEntityComponent();

            renderEntity.MaterialParameters[0] = surface.Color.X;
            renderEntity.MaterialParameters[1] = surface.Color.Y;
            renderEntity.MaterialParameters[2] = surface.Color.Z;
            renderEntity.MaterialParameters[3] = surface.Color.W;

            ViewEntity guiSpace = new ViewEntity();

            guiSpace.ModelMatrix     = modelMatrix;
            guiSpace.ModelViewMatrix = modelViewMatrix;
            guiSpace.WeaponDepthHack = depthHack;

            // add the surface, which might recursively create another gui
            idE.RenderSystem.AddDrawSurface(tri, guiSpace, renderEntity, surface.Material, idE.RenderSystem.ViewDefinition.Scissor);
        }
Exemplo n.º 2
0
        private void AdvanceSurface()
        {
            GuiModelSurface s = new GuiModelSurface();

            if (_surfaces.Count > 0)
            {
                s.Color    = _surface.Color;
                s.Material = _surface.Material;
            }
            else
            {
                s.Color    = new Vector4(1, 1, 1, 1);
                s.Material = idE.RenderSystem.DefaultMaterial;
            }

            s.IndexCount  = 0;
            s.FirstIndex  = _indexes.Count;
            s.VertexCount = 0;
            s.FirstVertex = _vertices.Count;

            _surfaces.Add(s);
            _surface = s;
        }
Exemplo n.º 3
0
		private void EmitSurface(GuiModelSurface surface, Matrix modelMatrix, Matrix modelViewMatrix, bool depthHack)
		{
			if(surface.VertexCount == 0)
			{
				// nothing in the surface
				return;
			}

			// copy verts and indexes
			Surface tri = new Surface();
			tri.Indexes = new int[surface.IndexCount];
			tri.Vertices = new Vertex[surface.VertexCount];

			_indexes.CopyTo(surface.FirstIndex, tri.Indexes, 0, surface.IndexCount);

			// we might be able to avoid copying these and just let them reference the list vars
			// but some things, like deforms and recursive
			// guis, need to access the verts in cpu space, not just through the vertex range
			_vertices.CopyTo(surface.FirstVertex, tri.Vertices, 0, surface.VertexCount);

			// move the verts to the vertex cache
			tri.AmbientCache = idE.RenderSystem.AllocateVertexCacheFrameTemporary(tri.Vertices);

			// if we are out of vertex cache, don't create the surface
			if(tri.AmbientCache == null)
			{
				return;
			}

			RenderEntityComponent renderEntity = new RenderEntityComponent();
			renderEntity.MaterialParameters[0] = surface.Color.X;
			renderEntity.MaterialParameters[1] = surface.Color.Y;
			renderEntity.MaterialParameters[2] = surface.Color.Z;
			renderEntity.MaterialParameters[3] = surface.Color.W;

			ViewEntity guiSpace = new ViewEntity();
			guiSpace.ModelMatrix = modelMatrix;
			guiSpace.ModelViewMatrix = modelViewMatrix;
			guiSpace.WeaponDepthHack = depthHack;

			// add the surface, which might recursively create another gui
			idE.RenderSystem.AddDrawSurface(tri, guiSpace, renderEntity, surface.Material, idE.RenderSystem.ViewDefinition.Scissor);
		}
Exemplo n.º 4
0
		private void AdvanceSurface()
		{
			GuiModelSurface s = new GuiModelSurface();

			if(_surfaces.Count > 0)
			{
				s.Color = _surface.Color;
				s.Material = _surface.Material;
			}
			else
			{
				s.Color = new Vector4(1, 1, 1, 1);
				s.Material = idE.RenderSystem.DefaultMaterial;
			}

			s.IndexCount = 0;
			s.FirstIndex = _indexes.Count;
			s.VertexCount = 0;
			s.FirstVertex = _vertices.Count;

			_surfaces.Add(s);
			_surface = s;
		}