EXTERN_FORM DLL_API Dvoid __cdecl coold_SetViewFactor(Dfloat* eye, Dfloat* lookat, Dfloat* up) { //시점 이동 if (!cc_use_camera.Bool()) { if (cc_x_eye.Bool()) eye[0] += cc_x_eye.Float(); if (cc_y_eye.Bool()) eye[1] += cc_y_eye.Float(); if (cc_z_eye.Bool()) eye[2] += cc_z_eye.Float(); g_matView = TransformHelper::CreateView(Vector3(eye), Vector3(lookat), Vector3(up)); } }
EXTERN_FORM DLL_API Dvoid __cdecl coold_UpdateCamera(Dint x, Dint y, Dint clickState, Dbool front, Dbool back, Dbool left, Dbool right, Dbool up, Dbool down) { if (cc_use_camera.Bool()) { MoveKey moveKey = { front, back, left, right, up, down }; GETSINGLE(Camera).UpdateCamera(x, y, clickState, moveKey, g_matView, g_matPers); } }
EXTERN_FORM DLL_API Dvoid __cdecl coold_SetTransform(Dint transformType, const Dfloat* matrix4x4) { //월드만 넘겨 받는다. switch( transformType ) { case 0: //World { Matrix44 matWorld(matrix4x4); g_matWorld = matWorld.Transpose(); //원점 기준으로 이동 if (cc_x_move.Bool()) g_matWorld[12] = cc_x_move.Float(); if (cc_y_move.Bool()) g_matWorld[13] = cc_y_move.Float(); if (cc_z_move.Bool()) g_matWorld[14] = cc_z_move.Float(); } break; default: break; } }
Dvoid RenderModule::Render( ) { if( m_pMesh == nullptr ) return; vector<BaseFace>* pvecFace = m_pMesh->GetVectorFace(); for( Dint faceNum = 0; faceNum < (Dint)pvecFace->size(); ++faceNum ) { BaseFace currentFace = (*pvecFace)[ faceNum ]; //projection frustum culling if( cc_use_frustumcull.Bool() && FrustumCulling(currentFace) ) { continue; } m_vecLine.clear(); m_edgeTable.clear(); m_activeTable.clear(); CreatePointsToLines(pvecFace, faceNum, m_vecLine); //backspace culling if( cc_use_backspacecull.Bool() && !BackSpaceCulling(m_vecLine) ) { continue; } auto unusualValue = STD_FIND_IF(m_vecLine, [] (const Line& line) { //모든 요소의 y 값이 같은지 체크 return line.beginVertex.y != line.endVertex.y; }); if( unusualValue != end(m_vecLine) ) { CreateEdgeTable(m_vecLine, m_edgeTable); CreateChainTable(m_vecLine, m_activeTable); DrawFace(m_activeTable, m_edgeTable, MixDotColor( currentFace.color )); } } }
EXTERN_FORM DLL_API Dvoid __cdecl coold_SetPerspectiveFactor(Dfloat fovY, Dfloat aspect, Dfloat zn, Dfloat zf) { if ( !cc_use_camera.Bool() ) g_matPers = TransformHelper::CreatePerspective(kPI / fovY, aspect, zn + cc_adjust_zn.Float(), zf + cc_adjust_zf.Float()); }