- Fixed metal canvas backend's drawBatch argument order
- Removed texturing in metal shader while we work on image API - Started working on simple image API
This commit is contained in:
parent
2b60db292a
commit
d1b71110bb
|
@ -1928,14 +1928,10 @@ void mg_render_stroke(mg_canvas_data* canvas,
|
|||
|
||||
void mg_render_rectangle_fill(mg_canvas_data* canvas, mp_rect rect, mg_attributes* attributes)
|
||||
{
|
||||
mg_next_shape(canvas, attributes->color);
|
||||
/*
|
||||
u32 baseIndex = mg_vertices_base_index(canvas);
|
||||
i32* indices = mg_reserve_indices(canvas, 6);
|
||||
|
||||
// mg_next_shape(canvas, attributes->color);
|
||||
|
||||
mg_next_shape(canvas, (mg_color){1, 0, 1, 1});
|
||||
mg_next_shape(canvas, attributes->color);
|
||||
|
||||
vec2 points[4] = {{rect.x, rect.y},
|
||||
{rect.x + rect.w, rect.y},
|
||||
|
@ -1954,35 +1950,6 @@ void mg_render_rectangle_fill(mg_canvas_data* canvas, mp_rect rect, mg_attribute
|
|||
indices[3] = baseIndex + 0;
|
||||
indices[4] = baseIndex + 2;
|
||||
indices[5] = baseIndex + 3;
|
||||
*/
|
||||
|
||||
f32 rx = rect.w/2;
|
||||
f32 ry = rect.h/2;
|
||||
|
||||
u32 baseIndex = mg_vertices_base_index(canvas);
|
||||
i32* indices = mg_reserve_indices(canvas, 6);
|
||||
|
||||
//NOTE(martin): inner diamond
|
||||
vec2 points[4] = {{rect.x, rect.y + ry},
|
||||
{rect.x + rx, rect.y},
|
||||
{rect.x + rect.w, rect.y + ry},
|
||||
{rect.x + rx, rect.y + rect.h}};
|
||||
|
||||
vec4 cubic = {1, 1, 1, 1};
|
||||
|
||||
for(int i=0; i<4; i++)
|
||||
{
|
||||
vec2 pos = mg_mat2x3_mul(canvas->transform, points[i]);
|
||||
mg_push_vertex(canvas, pos, cubic);
|
||||
}
|
||||
|
||||
indices[0] = baseIndex + 0;
|
||||
indices[1] = baseIndex + 1;
|
||||
indices[2] = baseIndex + 2;
|
||||
indices[3] = baseIndex + 0;
|
||||
indices[4] = baseIndex + 2;
|
||||
indices[5] = baseIndex + 3;
|
||||
|
||||
}
|
||||
|
||||
void mg_render_rectangle_stroke(mg_canvas_data* canvas, mp_rect rect, mg_attributes* attributes)
|
||||
|
|
|
@ -73,7 +73,7 @@ void mg_mtl_canvas_clear(mg_canvas_backend* interface, mg_color clearColor)
|
|||
backend->clearColor = clearColor;
|
||||
}
|
||||
|
||||
void mg_mtl_canvas_draw_batch(mg_canvas_backend* interface, u32 vertexCount, u32 indexCount, u32 shapeCount)
|
||||
void mg_mtl_canvas_draw_batch(mg_canvas_backend* interface, u32 shapeCount, u32 vertexCount, u32 indexCount)
|
||||
{
|
||||
mg_mtl_canvas_backend* backend = (mg_mtl_canvas_backend*)interface;
|
||||
mg_mtl_surface* surface = mg_mtl_canvas_get_surface(backend);
|
||||
|
|
|
@ -195,25 +195,11 @@ kernel void RenderKernel(texture2d<float, access::write> outTexture [[texture(0)
|
|||
|
||||
const uint tileBufferSize = tileCounters[tileIndex];
|
||||
|
||||
|
||||
//#define RENDERER_DEBUG_TILES
|
||||
#ifdef RENDERER_DEBUG_TILES
|
||||
//NOTE(martin): color code debug values and show the tile grid
|
||||
uint nTileX = tilesMatrixDim.x;
|
||||
uint nTileY = tilesMatrixDim.y;
|
||||
|
||||
if(tilePos.x == 2 && tilePos.y == 12)
|
||||
{
|
||||
outTexture.write(float4(1, 0.5, 1, 1), gid);
|
||||
return;
|
||||
}
|
||||
|
||||
if(nTileY != 13 || nTileX != 13)
|
||||
{
|
||||
outTexture.write(float4(1, 1, 0, 1), gid);
|
||||
return;
|
||||
}
|
||||
|
||||
if(tilePos.x > nTileX || tilePos.y > nTileY)
|
||||
{
|
||||
outTexture.write(float4(0, 1, 1, 1), gid);
|
||||
|
@ -331,7 +317,7 @@ kernel void RenderKernel(texture2d<float, access::write> outTexture [[texture(0)
|
|||
pixelColors[i] = nextColors[i];
|
||||
}
|
||||
|
||||
float4 nextCol = color*texColor;
|
||||
float4 nextCol = color;//*texColor;
|
||||
nextColors[i] = pixelColors[i]*(1-nextCol.a) +nextCol.a*nextCol;
|
||||
|
||||
zIndices[i] = shapeIndex;
|
||||
|
|
Loading…
Reference in New Issue