mikke89 on layout
[cherry pick] Make (non-explici… Refactor flex and table formatt… Some cleanup and 6 more (compare)
mikke89 on layout
WIP Formatting contexts WIP Make separate flex and tabl… Small refactor block container … and 3 more (compare)
mikke89 on build-fix
mikke89 on master
Fix compiler warnings (compare)
mikke89 on build-fix
Fix compiler warning 2 (compare)
void CRmlRenderInterface::RenderGeometry(Rml::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rml::TextureHandle texture, const Rml::Vector2f& translation)
{
static RwIm2DVertex rgVertices[4096];
static RwImVertexIndex rgIndices[4096];
if (num_vertices > ARRAY_COUNT(rgVertices) || num_indices > ARRAY_COUNT(rgIndices))
return;
float fZ = RwIm2DGetNearScreenZ();
float fRHW = 1.0f / CGTA::GetCurrentRWCamera()->nearPlane;
for (size_t i = 0; i < num_vertices; i++)
{
CVector3D::TransformCoordinate(CVector3D(vertices[i].position.x + translation.x, vertices[i].position.y + translation.y, fZ), m_matTransform, rgVertices[i].vec);
rgVertices[i].vec.x -= 0.5f;
rgVertices[i].vec.y -= 0.5f;
rgVertices[i].rhw = fRHW;
rgVertices[i].emissiveColor = CARGB(vertices[i].colour.alpha, vertices[i].colour.red, vertices[i].colour.green, vertices[i].colour.blue);
rgVertices[i].u = vertices[i].tex_coord.x;
rgVertices[i].v = vertices[i].tex_coord.y;
}
for (size_t i = 0; i < num_indices; i++)
{
rgIndices[i] = indices[i];
}
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
Texture* pTexture = (Texture*)texture;
RwRaster* pRwRaster = nullptr;
if (pTexture != nullptr)
pRwRaster = Rw2D.GetRwRaster(pTexture);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESRCBLEND, rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, TRUE);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (unsigned int)pRwRaster);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, rgVertices, num_vertices, rgIndices, num_indices);
}
Looks like this for example.