// レンダーステートをセット void CRenderState::SetRenderState( CGraphicsDevice* device, E_GRAPH_RENDER_STATE nState, IZ_DWORD val) { IZ_ASSERT(nState < E_GRAPH_RS_NUM); typedef void (CRenderState::*FUNC)(CGraphicsDevice*, IZ_DWORD); static FUNC func[] = { &CRenderState::EnableZWrite, // E_GRAPH_RS_ZWRITEENABLE &CRenderState::EnableZTest, // E_GRAPH_RS_ZENABLE &CRenderState::SetZTestFunc, // E_GRAPH_RS_ZFUNC &CRenderState::EnableAlphaTest, // E_GRAPH_RS_ALPHATESTENABLE &CRenderState::SetAlphaTestRef, // E_GRAPH_RS_ALPHAREF &CRenderState::SetAlphaTestFunc, // E_GRAPH_RS_ALPHAFUNC &CRenderState::EnableAlphaBlend, // E_GRAPH_RS_ALPHABLENDENABLE &CRenderState::SetAlphaBlendMethod, // E_GRAPH_RS_BLENDMETHOD &CRenderState::SetFillMode, // E_GRAPH_RS_FILLMODE &CRenderState::SetCullMode, // E_GRAPH_RS_CULLMODE &CRenderState::EnableRenderColorRGB, // E_GRAPH_RS_COLORWRITEENABLE_RGB &CRenderState::EnableRenderColorA, // E_GRAPH_RS_COLORWRITEENABLE_A &CRenderState::EnableScissorTest, // E_GRAPH_RS_SCISSORTESTENABLE &CRenderState::EnableStencilTest, // E_GRAPH_RS_STENCIL_ENABLE }; IZ_C_ASSERT(COUNTOF(func) == E_GRAPH_RS_NUM); (this->*func[nState])(device, val); }
void CRenderState::SetScissorRect(CGraphicsDevice* device, const SIntRect& rc) { // 念のためこれくらいはチェックするか IZ_C_ASSERT(sizeof(RECT) == sizeof(CIntRect)); CGraphicsDeviceDX9* dx9Device = reinterpret_cast<CGraphicsDeviceDX9*>(device); if (rcScissor != rc) { rcScissor = rc; D3D_DEVICE* d3DDev = dx9Device->GetRawInterface(); d3DDev->SetScissorRect(reinterpret_cast<RECT*>(&rcScissor)); } }
void CColladaAnimation::GetTransform( domElement* pContent, SJointTransform& sTransform) { IZ_C_ASSERT((0 < _NUM) && (_NUM <= 4)); _T* pTransform = reinterpret_cast<_T*>(pContent); IZ_ASSERT(pTransform->getValue().getCount() == _NUM); sTransform.name = pTransform->getSid(); for (IZ_UINT i = 0; i < _NUM; i++) { sTransform.param.push_back((IZ_FLOAT)pTransform->getValue().get(i)); } }
CColladaAnimation::E_TRANSFROM_TYPE CColladaAnimation::GetTransformType(IZ_PCSTR pszType) { IZ_PCSTR tblType[] = { "translate", // E_MDL_JOINT_TRANSFORM_TRANSLATE "rotate", // E_MDL_JOINT_TRANSFORM_QUATERNION "scale", // E_MDL_JOINT_TRANSFORM_SCALE }; IZ_C_ASSERT(COUNTOF(tblType) == E_TRANSFROM_TYPE_NUM); for (IZ_UINT i = 0; i < E_TRANSFROM_TYPE_NUM; i++) { if (izanagi::tool::CString::CmpStr(tblType[i], pszType)) { return (E_TRANSFROM_TYPE)i; } } IZ_ASSERT(IZ_FALSE); return E_TRANSFROM_TYPE_NUM; }
CColladaAnimation::E_INPUT_SEMANTIC CColladaAnimation::ConvSemanticFromString(daeString str) { daeString tblSemantic[] = { "INPUT", "OUTPUT", "IN_TANGENT", "OUT_TANGENT", "INTERPOLATION", }; IZ_C_ASSERT(COUNTOF(tblSemantic) == E_INPUT_SEMANTIC_NUM); for (IZ_UINT i = 0; i < E_INPUT_SEMANTIC_NUM; i++) { if (izanagi::tool::CString::CmpStr(tblSemantic[i], str)) { return static_cast<E_INPUT_SEMANTIC>(i); } } IZ_ASSERT(IZ_FALSE); return E_INPUT_SEMANTIC_NUM; }