void pawsConfigCamera::SaveConfigByTreeNodes(pawsTreeNode * subtreeRoot) { pawsSeqTreeNode * rootAsSeq; rootAsSeq = dynamic_cast<pawsSeqTreeNode*> (subtreeRoot); if (rootAsSeq != NULL) { csString cammode = subtreeRoot->GetAttr("cammode"); int currCamMode = -1; if (cammode == "First Person") currCamMode = psCamera::CAMERA_FIRST_PERSON; else if (cammode == "Third Person Follow") currCamMode = psCamera::CAMERA_THIRD_PERSON; else if (cammode == "Third Person M64") currCamMode = psCamera::CAMERA_M64_THIRD_PERSON; else if (cammode == "Third Person Lara") currCamMode = psCamera::CAMERA_LARA_THIRD_PERSON; else if (cammode == "Free Rotation") currCamMode = psCamera::CAMERA_FREE; if (!strcmp(subtreeRoot->GetAttr("type"), "onoff")) { pawsButton* button = dynamic_cast <pawsButton*> (rootAsSeq->GetSeqWidget(1)); assert(button); SetCameraSetting(subtreeRoot->GetName(), (button->GetState() ? 1 : -1), currCamMode); } else if (!strcmp(subtreeRoot->GetAttr("type"), "real")) { pawsSpinBox* spin = dynamic_cast <pawsSpinBox*> (rootAsSeq->GetSeqWidget(1)); assert(spin); SetCameraSetting(subtreeRoot->GetName(), spin->GetValue(), currCamMode); } } pawsTreeNode *child = subtreeRoot->GetFirstChild(); while (child != NULL) { SaveConfigByTreeNodes(child); child = child->GetNextSibling(); } }
CCamera::CCamera(float width, float height, ECameraSetting setting) { mFovY = XM_PIDIV4; mFrontClip = 0.1f; mBackClip = 10000.0f; mAspect = 1.0f; // Initialise view matrix and variables mWorldMat = XMMatrixIdentity(); mView = XMMatrixIdentity(); mProjection = XMMatrixIdentity(); mPos = XMFLOAT3(0.0f, 0.0f, 0.0f); mParent = NULL; SetCameraSetting( setting ); }