本文整理汇总了C++中PNG::open方法的典型用法代码示例。如果您正苦于以下问题:C++ PNG::open方法的具体用法?C++ PNG::open怎么用?C++ PNG::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNG
的用法示例。
在下文中一共展示了PNG::open方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
int CHeightMap::Load(const char* filename, float width, float height)
{
/*m_Model = CResourceHandler::LoadModel(filename, 500, -90, 1, 0, 0);
m_NumVertices = m_Model->m_Vertices.size();
m_NumIndices = m_Model->m_VertIndices.size();
m_Vertices = new dVector3[m_NumVertices];
m_Indices = new int[m_NumIndices];
for(int i = 0; i < m_NumVertices; i++)
{
m_Vertices[i][0] = m_Model->m_Vertices[i].x;
m_Vertices[i][1] = m_Model->m_Vertices[i].y;
m_Vertices[i][2] = m_Model->m_Vertices[i].z;
}
for(int i = 0; i < m_NumIndices; i++)
{
m_Indices[i] = m_Model->m_VertIndices[i] - 1;
}
SetCollisionHeightmap(m_Vertices, m_Indices, m_NumVertices, m_NumIndices);
SetPosition(0.0f, 0.0f, 0.0f);*/
PNG heightmap;
int counter = 0;
if(!heightmap.open(filename))
{
return 0;
}
m_Samples.x = (float)heightmap.width;
m_Samples.y = (float)heightmap.height;
m_Size.x = width;
m_Size.y = height;
m_Scale = 1.0f;
m_Heightdata = new float[int(m_Samples.x * m_Samples.y)];
for(int i = 0; i < m_Samples.y; i++)
{
for(int j = 0; j < m_Samples.x; j++)
{
m_Heightdata[counter] = heightmap.row_pointers[i][j*3];
counter++;
}
}
// SetCollisionHeightmap(m_Heightdata, m_Size.x, m_Size.y, m_Samples.x, m_Samples.y, m_Scale, 10.0f);
// SetPosition(0.0f, 0.0f, 0.0f);
m_UseVBO = 1.0f;
// GenVBO();
return 1;
}