void LayerForceWidget::Init(SceneEditor2* scene, ParticleLayer* layer, uint32 forceIndex, bool updateMinimized) { if (!layer || layer->forces.size() <= forceIndex) { return; } this->layer = layer; this->forceIndex = forceIndex; SetActiveScene(scene); blockSignals = true; float32 lifeTime = layer->endTime; ParticleForce* curForce = layer->forces[forceIndex]; Vector<QColor> colors; colors.push_back(Qt::red); colors.push_back(Qt::darkGreen); colors.push_back(Qt::blue); Vector<QString> legends; legends.push_back("force x"); legends.push_back("force y"); legends.push_back("force z"); forceTimeLine->Init(layer->startTime, lifeTime, updateMinimized, true, false); forceTimeLine->AddLines(PropLineWrapper<Vector3>(PropertyLineHelper::GetValueLine(curForce->force)).GetProps(), colors, legends); forceTimeLine->EnableLock(true); legends.clear(); legends.push_back("force variable x"); legends.push_back("force variable y"); legends.push_back("force variable z"); forceOverLifeTimeLine->Init(0, 1, updateMinimized, true, false); forceOverLifeTimeLine->AddLine(0, PropLineWrapper<float32>(PropertyLineHelper::GetValueLine(curForce->forceOverLife)).GetProps(), Qt::blue, "forces over life"); blockSignals = false; }
void CModelViewRender::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { CView::OnActivateView(bActivate, pActivateView, pDeactiveView); CGuiMDIFrame *mainWnd = DYNAMIC_DOWNCAST(CGuiMDIFrame, AfxGetMainWnd()); if (bActivate) { if (!m_bActivated) { SetActiveScene(); ActivateView(); mainWnd->LoadDocumentBars(_T("ModelView")); m_bActivated = true; } } else if (m_bActivated) { DeactivateView(); mainWnd->SaveDocumentBars(_T("ModelView")); m_bActivated = false; } }
void CModelViewRender::InitRenderScene() { // set active scene to model view scene so objects created here will be placed in the correct scene SetActiveScene(); //Create Cal3DRenderObject from loaded file CreateScene(); // create a new Memory Archive IArchive *pArchive = CreateMemoryArchive(); if (pArchive == NULL) { return; } StdString szEntityType(_T("EditorObject")); //Vec3 v3Zero(0.0f, 0.0f, 0.0f); Vec3 v3EntityLightPosition(0.0f, 200.0f, 200.0f); EulerAngle eaZero; Vec3 v3Scale(1.0f, 1.0f, 1.0f); pArchive->Write(szEntityType, _T("EntityType")); pArchive->Write(v3EntityLightPosition, _T("Position")); pArchive->Write(eaZero, _T("Rotation")); pArchive->Write(v3Scale, _T("Scale")); pArchive->SetIsWriting(false); CFileVersionSetter setter; // Create the CEntity LightObject Parent ///////////////////////////////////////////////////////// static CHashString hszCEntity(_T("CEntity")); if (CreateEEObject(&m_hszSceneName, &hszCEntity, m_hszLightEntityName, pArchive)) { pArchive->SetIsWriting(true); pArchive->SeekTo(0); int iVersionNumber = 1000; Vec3 v3LightPosition( 0.0, 0.0f, 0.0f ); Vec3 v3LightDirection( 0.0f, 0.0f, 0.0f ); float fAttenuation = 99999.0f; float fColor[] = { 0.75f, 0.75f, 0.75f, 1.0f }; StdString szLightType(_T("OMNI_POINT_LIGHT")); bool bCastShadows = false; UINT numKeys = 0; pArchive->Write(iVersionNumber, _T("Version")); pArchive->Write(v3LightPosition, _T("Position")); pArchive->Write(v3LightDirection, _T("Direction")); pArchive->Write(fAttenuation, _T("Attenuation")); pArchive->Write(fColor[0], _T("ColorRed") ); pArchive->Write(fColor[1], _T("ColorGreen") ); pArchive->Write(fColor[2], _T("ColorBlue") ); pArchive->Write(fColor[3], _T("ColorAlpha") ); pArchive->Write(szLightType, _T("LightType") ); pArchive->Write(bCastShadows, _T("CastShadows") ); pArchive->Write(numKeys, _T("NumKeyframes") ); pArchive->SetIsWriting(false); // Create the Light Object //////////////////////////////////////////////////////////////// static CHashString hszCLightObject(_T("CLightObject")); CreateEEObject(&m_hszLightEntityName, &hszCLightObject, m_hszLightObjectName, pArchive); } pArchive->Close(); }