const bool VCNRenderNode::UpdateWorldTransform() { if ( VCNNode::UpdateWorldTransform() ) { // Update mesh bounding sphere const VCNResID meshID = GetMeshID(); if ( meshID != kInvalidResID ) { VCNMesh* mesh = VCNResourceCore::GetInstance()->GetResource<VCNMesh>(meshID); const VCNSphere boundingSphere = mesh->GetBoundingSphere(); // Transform the sphere relative to the render node const Vector3 ascSacle = GetWorldScale(); const VCNFloat radius = boundingSphere.GetRadius() * std::max(ascSacle.x, std::max(ascSacle.y, ascSacle.z)); mBoundingSphere.Set( radius, boundingSphere.GetCenter() * mWorld ); mBoundingBox.vcMin = (mesh->GetBoundingBox().vcMin.MulComponents(ascSacle)) + GetWorldTranslation(); mBoundingBox.vcMax = (mesh->GetBoundingBox().vcMax.MulComponents(ascSacle)) + GetWorldTranslation(); } return true; } return false; }
void CPointLightComponent::UpdateComponent(float) { if (m_pointLight.m_isLightEnabled) { m_pointLight.m_gpuPointLight.m_lightPosition = GetWorldTranslation(); URenderer& targetRenderer = gEngine->GetRenderer(); targetRenderer.QueuePointLight(GetObjectID(), m_pointLight.m_gpuPointLight); } }