2016-03-21 04:10:14 +00:00
|
|
|
#include "Model.h"
|
|
|
|
|
|
|
|
namespace New3D {
|
|
|
|
|
|
|
|
NodeAttributes::NodeAttributes()
|
|
|
|
{
|
2016-06-16 20:05:29 +00:00
|
|
|
currentTexOffsetX = 0;
|
|
|
|
currentTexOffsetY = 0;
|
|
|
|
currentPage = 0;
|
|
|
|
currentClipStatus = Clip::INTERCEPT;
|
2017-07-29 16:30:30 +00:00
|
|
|
currentModelScale = 1.0f;
|
2016-03-21 04:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool NodeAttributes::Push()
|
|
|
|
{
|
|
|
|
//=============
|
|
|
|
NodeAttribs na;
|
|
|
|
//=============
|
|
|
|
|
|
|
|
// check for overflow
|
|
|
|
if (m_vecAttribs.size() >= 128) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-06-16 20:05:29 +00:00
|
|
|
na.page = currentPage;
|
|
|
|
na.texOffsetX = currentTexOffsetX;
|
|
|
|
na.texOffsetY = currentTexOffsetY;
|
|
|
|
na.clip = currentClipStatus;
|
2017-07-29 16:30:30 +00:00
|
|
|
na.modelScale = currentModelScale;
|
2016-03-21 04:10:14 +00:00
|
|
|
|
2017-07-29 16:30:30 +00:00
|
|
|
m_vecAttribs.emplace_back(na);
|
2016-03-21 04:10:14 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NodeAttributes::Pop()
|
|
|
|
{
|
|
|
|
if (m_vecAttribs.empty()) {
|
|
|
|
return false; // check for underflow
|
|
|
|
}
|
|
|
|
|
2017-07-29 16:30:30 +00:00
|
|
|
auto &last = m_vecAttribs.back();
|
2016-06-10 10:18:47 +00:00
|
|
|
|
2017-07-29 16:30:30 +00:00
|
|
|
currentPage = last.page;
|
|
|
|
currentTexOffsetX = last.texOffsetX;
|
|
|
|
currentTexOffsetY = last.texOffsetY;
|
|
|
|
currentClipStatus = last.clip;
|
|
|
|
currentModelScale = last.modelScale;
|
2016-03-21 04:10:14 +00:00
|
|
|
|
|
|
|
m_vecAttribs.pop_back();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NodeAttributes::StackLimit()
|
|
|
|
{
|
|
|
|
return m_vecAttribs.size() >= 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NodeAttributes::Reset()
|
|
|
|
{
|
2016-06-16 20:05:29 +00:00
|
|
|
currentPage = 0;
|
|
|
|
currentTexOffsetX = 0;
|
|
|
|
currentTexOffsetY = 0;
|
|
|
|
currentClipStatus = Clip::INTERCEPT;
|
2017-07-29 16:30:30 +00:00
|
|
|
currentModelScale = 1.0f;
|
2016-06-16 20:05:29 +00:00
|
|
|
|
2016-03-21 04:10:14 +00:00
|
|
|
m_vecAttribs.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // New3D
|