public void Start(int vpWidth, int vpHeight)
        {
            if (active)
            {
                throw new InvalidOperationException("Renderer2D.Start() called without calling Renderer2D.Finish()");
            }
            active        = true;
            this.vpHeight = vpHeight;
            var mat = Matrix4x4.CreateOrthographicOffCenter(0, vpWidth, vpHeight, 0, 0, 1);

            imgShader.SetMatrix(imgShader.GetLocation("modelviewproj"), ref mat);
            currentMode = BlendMode.Normal;
            vertices    = (Vertex2D *)vbo.BeginStreaming();
        }
예제 #2
0
 public void Begin(ICamera cam, CommandBuffer cmd)
 {
     camera         = cam;
     billboardCount = vertexCountBasic = indexCountBasic = 0;
     buffer         = cmd;
     verticesBasic  = (BillboardVert *)vboBasic.BeginStreaming();
 }
예제 #3
0
 void Prepare(BlendMode mode, Texture2D tex, bool circle)
 {
     if (currentMode != mode ||
         isCircle != circle ||
         (currentTexture != null && (currentTexture != tex && currentTexture != dot) && tex != dot) ||
         (primitiveCount + 2) * 3 >= MAX_INDEX ||
         (vertexCount + 4) >= MAX_VERT)
     {
         Flush();
     }
     if (vertices == (Vertex2D *)0)
     {
         currentMode    = BlendMode.Normal;
         currentTexture = null;
         vertices       = (Vertex2D *)vbo.BeginStreaming();
         isCircle       = false;
     }
     if (tex == dot)
     {
         currentTexture ??= tex;
     }
     else
     {
         currentTexture = tex;
     }
     currentMode = mode;
     isCircle    = circle;
 }
예제 #4
0
 public void Begin(CommandBuffer commands, ResourceManager res, ICamera cam)
 {
     this.commands = commands;
     this.res      = res;
     shader.SetViewProjection(cam);
     verticesSpear = (VertexPositionColorTexture *)bufferSpear.BeginStreaming();
     verticesBolt  = (VertexPositionColorTexture *)bufferBolt.BeginStreaming();
 }
예제 #5
0
 public void Begin(CommandBuffer commands, ResourceManager res, ICamera cam)
 {
     this.commands = commands;
     this.res      = res;
     shader.SetViewProjection(cam);
     verticesSpear = (VertexPositionColorTexture *)bufferSpear.BeginStreaming();
     verticesBolt  = (VertexPositionColorTexture *)bufferBolt.BeginStreaming();
     if (begun)
     {
         throw new InvalidOperationException();
     }
     begun = true;
 }
예제 #6
0
 public void NewFrame()
 {
     lastIndex = currentIndex = currentVerts = 0;
     verts     = (VertexPositionTexture *)vbo.BeginStreaming();
 }