Example #1
0
        public static void draw( ClassTexture texture, CompoundCorners uv, CompoundQuad vertices,
            CompoundColorGradient colors, CompoundRender render_flags, CompoundBlend blend_fn)
        {
            DrawBuffer.set_render_flags( render_flags.property_flags,
            blend_fn.property_src_blend, blend_fn.property_dest_blend );
              DrawBuffer.set_textured_triangle_mode( texture, null );

              Vector3 pt1 = Plasmacore.v3( vertices.property_top_left );
              Vector3 pt2 = Plasmacore.v3( vertices.property_top_right );
              Vector3 pt3 = Plasmacore.v3( vertices.property_bottom_right );
              Vector3 pt4 = Plasmacore.v3( vertices.property_bottom_left );

              NativeTransformManager.update();
              pt1 = NativeTransformManager.transform.transform( pt1 );
              pt2 = NativeTransformManager.transform.transform( pt2 );
              pt3 = NativeTransformManager.transform.transform( pt3 );
              pt4 = NativeTransformManager.transform.transform( pt4 );

              int argb = colors.property_top_left.property_argb;
              Color c1 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);
              argb = colors.property_top_right.property_argb;
              Color c2 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);
              argb = colors.property_bottom_right.property_argb;
              Color c3 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);
              argb = colors.property_bottom_left.property_argb;
              Color c4 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);

              float uv_a_x = (float) uv.property_top_left.property_x;
              float uv_a_y = (float) uv.property_top_left.property_y;
              float uv_b_x = (float) uv.property_bottom_right.property_x;
              float uv_b_y = (float) uv.property_bottom_right.property_y;

              VertexPositionColorTexture v1, v2, v3, v4;
              v1 = new VertexPositionColorTexture( pt1, c1, new Vector2( uv_a_x, uv_a_y ) );
              v2 = new VertexPositionColorTexture( pt2, c2, new Vector2( uv_b_x, uv_a_y ) );
              v3 = new VertexPositionColorTexture( pt3, c3, new Vector2( uv_b_x, uv_b_y ) );
              v4 = new VertexPositionColorTexture( pt4, c4, new Vector2( uv_a_x, uv_b_y ) );

              DrawBuffer.add( v1, v2, v4 );
              DrawBuffer.add( v4, v2, v3 );
        }
Example #2
0
        public static void fill( ClassQuadManager obj, CompoundQuad quad, 
            CompoundColorGradient colors, CompoundRender render_flags)
        {
            DrawBuffer.set_render_flags( render_flags.property_flags,
            DrawBuffer.BLEND_SRC_ALPHA, DrawBuffer.BLEND_INVERSE_SRC_ALPHA );
              DrawBuffer.set_solid_triangle_mode();

              Vector3 pt1 = Plasmacore.v3( quad.property_top_left );
              Vector3 pt2 = Plasmacore.v3( quad.property_top_right );
              Vector3 pt3 = Plasmacore.v3( quad.property_bottom_right );
              Vector3 pt4 = Plasmacore.v3( quad.property_bottom_left );

              NativeTransformManager.update();
              pt1 = NativeTransformManager.transform.transform( pt1 );
              pt2 = NativeTransformManager.transform.transform( pt2 );
              pt3 = NativeTransformManager.transform.transform( pt3 );
              pt4 = NativeTransformManager.transform.transform( pt4 );

              int argb = colors.property_top_left.property_argb;
              Color c1 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);
              argb = colors.property_top_right.property_argb;
              Color c2 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);
              argb = colors.property_bottom_right.property_argb;
              Color c3 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);
              argb = colors.property_bottom_left.property_argb;
              Color c4 = new Color((argb>>16)&255,(argb>>8)&255,argb&255,(argb>>24)&255);

              Vector2 zero_uv = new Vector2(0,0);
              VertexPositionColorTexture v1, v2, v3, v4;
              v1 = new VertexPositionColorTexture( pt1, c1, zero_uv );
              v2 = new VertexPositionColorTexture( pt2, c2, zero_uv );
              v3 = new VertexPositionColorTexture( pt3, c3, zero_uv );
              v4 = new VertexPositionColorTexture( pt4, c4, zero_uv );

              DrawBuffer.add( v1, v2, v4 );
              DrawBuffer.add( v4, v2, v3 );
        }