Skip to content

Lua calling GetLightmapPageSize #3143

@Akabenko

Description

@Akabenko

Description

Functions ITexture:GetMappingWidth, ITexture:Width, ITexture:GetMappingHeight, ITexture:Height can't get a lightmaps size. Therefore, I propose to add a function GetLightmapPageSize. This will simplify manual work with lightmaps.

if (!IsErrorTexture(g_pMaterialSystem->FindTexture("[lightmap0]", ""))) // Boundaries check
{
	int nLightmapWidth;
	int nLightmapHeight;
	g_pMaterialSystem->GetLightmapPageSize(0, &nLightmapWidth, &nLightmapHeight);

	ConMsg("nLightmapWidth: %d; nLightmapHeight: %d\n", nLightmapWidth, nLightmapHeight);
}
-- thanks mutezero
Image

Other methods (invalid):

ITexture* m_pLightmapTexture = materials->FindTexture("[lightmap0]", TEXTURE_GROUP_LIGHTMAP);
        
if (m_pLightmapTexture) {
    int nLightmapWidth = m_pLightmapTexture->GetActualWidth();
    int nLightmapHeight = m_pLightmapTexture->GetActualHeight();
    ConMsg("GetActualWidth: %d; GetActualHeight: %d\n", nLightmapWidth, nLightmapHeight);

    int nLightmapWidth2 = m_pLightmapTexture->GetMappingWidth();
    int nLightmapHeight2 = m_pLightmapTexture->GetMappingHeight();
    ConMsg("GetMappingWidth: %d; GetMappingHeight: %d\n", nLightmapWidth2, nLightmapHeight2);
}
Image

Alternatively:

pShaderAPI->GetLightmapDimensions(&nLightmapWidth, &nLightmapHeight);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Lua APIA request to add a new function.ShadersThe issue relates to shaders.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions