mikke89 on layout
Floating elements are now place… Add relative position test Add any ancestor relative posit… and 1 more (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.