LTBOOL CPolygonDebrisFX::Update() { if (!CDebrisFX::Update()) return LTFALSE; for (int i=0; i < m_nNumPolies; i++) { if (m_Polies[i] == LTNULL) continue; // Align poly forward vector to movement direction... if (!m_cs.PolyDebrisFX.bShowTrail) { LTVector vDir = GetEmitter(i)->m_vLastPos - GetEmitter(i)->m_vPos; LTRotation rRot; rRot = m_Polies[i]->GetRot(); g_pLTClient->AlignRotation(&rRot, &vDir, LTNULL); m_Polies[i]->SetRot(rRot); } m_Polies[i]->Update(); } return LTTRUE; }
void EmitterAttributeEditor::HandleIsSortedChanged(int value) { if(updatingWidget_) return; GetEffect()->SetSorted(value == 1); GetEmitter()->SetSorted(value == 1); }
void EmitterAttributeEditor::HandleActiveTimeChanged(float value) { if(updatingWidget_) return; GetEffect()->SetActiveTime(value); GetEmitter()->ApplyEffect(); }
void EmitterAttributeEditor::HandleMaxParticlesEditorValueChanged(int value) { if(updatingWidget_) return; GetEffect()->SetNumParticles(maxParticleEditor_->value()); GetEmitter()->ApplyEffect(); }
void ParticleEmitterPropertyControl::ReadFrom(Entity * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); ParticleEmitter * emitter = GetEmitter(sceneNode); DVASSERT(emitter); propertyList->AddSection("Particles emitter"); propertyList->AddStringProperty("Yaml path", PropertyList::PROPERTY_IS_READ_ONLY); propertyList->SetStringPropertyValue("Yaml path", emitter->GetConfigPath().GetAbsolutePathname()); }
PropertyControlCreator::ePropertyControlIDs PropertyControlCreator::DetectNodeType(SceneNode *node) { if(node->GetComponent(Component::LIGHT_COMPONENT)) { return EPCID_LIGHT; } if(node->GetComponent(Component::CAMERA_COMPONENT)) { return EPCID_CAMERA; } if(node->GetComponent(Component::SWITCH_COMPONENT)) { return EPCID_SWITCH; } if(GetEmitter(node)) { return EPCID_PARTICLE_EMITTER; } if(node->GetComponent(Component::PARTICLE_EFFECT_COMPONENT)) { return EPCID_PARTICLE_EFFECT; } if(node->GetComponent(Component::LOD_COMPONENT)) { return EPCID_LODNODE; } RenderComponent *rc = static_cast<RenderComponent *>(node->GetComponent(Component::RENDER_COMPONENT)); if(rc) { RenderObject *ro = rc->GetRenderObject(); if(dynamic_cast<LandscapeNode *>(ro)) { return EPCID_LANDSCAPE; } } return EPCID_NODE; }
void SceneValidator::ValidateParticleEmitterComponent(DAVA::Entity *ownerNode, Set<String> &errorsLog) { ParticleEmitter * emitter = GetEmitter(ownerNode); if(!emitter) { return; } if (GetLodComponent(ownerNode) == NULL) { ownerNode->AddComponent(ScopedPtr<LodComponent> (new LodComponent())); } ValidateParticleEmitter(emitter, errorsLog); }
void SceneValidator::ValidateLodComponent(Entity *ownerNode, Set<String> &errorsLog) { LodComponent *lodComponent = GetLodComponent(ownerNode); if(!lodComponent) return; int32 layersCount = lodComponent->GetLodLayersCount(); if (GetEmitter(ownerNode)) layersCount = LodComponent::MAX_LOD_LAYERS; if(layersCount == 0) { errorsLog.insert(Format("Node %s: Count of layers is 0", ownerNode->GetName().c_str())); } for(int32 layer = 0; layer < layersCount; ++layer) { float32 distance = lodComponent->GetLodLayerDistance(layer); if(LodComponent::INVALID_DISTANCE == distance) { //TODO: why this function isn't realized for lodcomponent? lodComponent->SetLodLayerDistance(layer, LodComponent::GetDefaultDistance(layer)); errorsLog.insert(Format("Node %s: lod distances weren't correct. Re-save.", ownerNode->GetName().c_str())); } } Vector<LodComponent::LodData *>lodLayers; lodComponent->GetLodData(lodLayers); Vector<LodComponent::LodData *>::const_iterator endIt = lodLayers.end(); int32 layer = 0; for(Vector<LodComponent::LodData *>::iterator it = lodLayers.begin(); it != endIt; ++it, ++layer) { LodComponent::LodData * ld = *it; if(ld->layer != layer) { ld->layer = layer; errorsLog.insert(Format("Node %s: lod layers weren't correct. Rename childs. Re-save.", ownerNode->GetName().c_str())); } } }
void UpdateSounds() { for (int i = 0; i < nSources; i++) { if (sources[i].active) { auto sound = sources[i].usingSound; // Update and Emitter::UpdateSound can call Sound::Stop if (not sound->IsStopped()) { sound->Update(); } if (not sound->IsStopped()) { sound->GetEmitter()->UpdateSound(*sound); } if (sound->IsStopped()) { sources[i].active = false; sources[i].usingSound = nullptr; } } } }
//slots void EmitterAttributeEditor::HandleSelectMaterialClick() { QString fileName = QFileDialog::getOpenFileName(0, tr("Material"), "./Data/Materials/", "*.xml"); if(fileName.isEmpty()) return; //must in app path static QString dataPath = qApp->applicationDirPath() + "/Data/"; if(fileName.toUpper().left(dataPath.toUpper().length()) != dataPath.toUpper()) return; fileName = fileName.right(fileName.length() - dataPath.length()); ResourceCache* cache = GetSubsystem<ResourceCache>(); Material* material = cache->GetResource<Material>(fileName.toLatin1().data()); if(material == NULL) return; materialPathEditor_->setText(fileName); GetEffect()->SetMaterial(material); GetEmitter()->SetMaterial(material); }
void EditorScene::SetSelection(Entity *newSelection) { if (selection) { uint32 flags = selection->GetDebugFlags(); uint32 newFlags = flags & ~DebugRenderComponent::DEBUG_DRAW_AABOX_CORNERS; selection->SetDebugFlags(newFlags); } selection = newSelection; selectedEntity = newSelection; if (selection) { Entity * solid = GetSolidParent(selection); if(solid == 0 && (selection->GetComponent(Component::PARTICLE_EFFECT_COMPONENT) || GetEmitter(selection))) { // Magic fix for correct node selection solid = selection; } if(solid == 0) { solid = GetLodParent(selection); } if(solid) { selection = solid; } proxy = selection; } else { proxy = 0; lastSelectedPhysics = 0; } if(selection) { uint32 flags = selection->GetDebugFlags(); uint32 newFlags = flags | DebugRenderComponent::DEBUG_DRAW_AABOX_CORNERS; selection->SetDebugFlags(newFlags); } }