2016-03-21 04:10:14 +00:00
|
|
|
#include "Model.h"
|
|
|
|
|
|
|
|
namespace New3D {
|
|
|
|
|
|
|
|
NodeAttributes::NodeAttributes()
|
|
|
|
{
|
|
|
|
currentTexOffsetX = 0;
|
|
|
|
currentTexOffsetY = 0;
|
2016-05-30 13:25:00 +00:00
|
|
|
page = 0;
|
2016-03-21 04:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool NodeAttributes::Push()
|
|
|
|
{
|
|
|
|
//=============
|
|
|
|
NodeAttribs na;
|
|
|
|
//=============
|
|
|
|
|
|
|
|
// check for overflow
|
|
|
|
if (m_vecAttribs.size() >= 128) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-05-30 13:25:00 +00:00
|
|
|
na.page = page;
|
2016-03-21 04:10:14 +00:00
|
|
|
na.texOffsetX = currentTexOffsetX;
|
|
|
|
na.texOffsetY = currentTexOffsetY;
|
|
|
|
|
|
|
|
m_vecAttribs.push_back(na);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NodeAttributes::Pop()
|
|
|
|
{
|
|
|
|
if (m_vecAttribs.empty()) {
|
|
|
|
return false; // check for underflow
|
|
|
|
}
|
|
|
|
|
2016-05-30 13:25:00 +00:00
|
|
|
page = m_vecAttribs.back().page;
|
2016-03-21 04:10:14 +00:00
|
|
|
currentTexOffsetX = m_vecAttribs.back().texOffsetX;
|
|
|
|
currentTexOffsetY = m_vecAttribs.back().texOffsetY;
|
|
|
|
|
|
|
|
m_vecAttribs.pop_back();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NodeAttributes::StackLimit()
|
|
|
|
{
|
|
|
|
return m_vecAttribs.size() >= 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NodeAttributes::Reset()
|
|
|
|
{
|
2016-05-30 13:25:00 +00:00
|
|
|
page = 0;
|
2016-03-21 04:10:14 +00:00
|
|
|
currentTexOffsetX = 0;
|
|
|
|
currentTexOffsetY = 0;
|
|
|
|
m_vecAttribs.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // New3D
|