Esempio n. 1
0
    ClwScene& SceneTracker::CompileScene(Scene const& scene) const
    {
        auto iter = m_scene_cache.find(&scene);

        if (iter == m_scene_cache.cend())
        {
            auto res = m_scene_cache.emplace(std::make_pair(&scene, ClwScene()));

            RecompileFull(scene, res.first->second);

            ReloadIntersector(scene, res.first->second);

            m_current_scene = &scene;

            return res.first->second;
        }
        else
        {
            auto& out = iter->second;

            if (scene.dirty() & Scene::DirtyFlags::kCamera)
            {
                UpdateCamera(scene, out);
            }

            if (scene.dirty() & Scene::DirtyFlags::kGeometry)
            {
                UpdateGeometry(scene, out);
            }
            else if (scene.dirty() & Scene::DirtyFlags::kGeometryTransform)
            {
                // TODO: this is not yet supported in the renderer
            }

            if (scene.dirty() & Scene::DirtyFlags::kMaterials)
            {
                UpdateMaterials(scene, out);
            }
            else if (scene.dirty() & Scene::DirtyFlags::kMaterialInputs)
            {
                UpdateMaterialInputs(scene, out);
            }

            if (m_current_scene != &scene)
            {
                ReloadIntersector(scene, out);

                m_current_scene = &scene;
            }

            scene.clear_dirty();

            return out;
        }
    }
	void cPhysicsMaterialNewton::SetStaticFriction(float afElasticity)
	{
		mfStaticFriction = afElasticity;

		UpdateMaterials();
	}
	void cPhysicsMaterialNewton::SetElasticity(float afElasticity)
	{
		mfElasticity = afElasticity;

		UpdateMaterials();
	}
	void cPhysicsMaterialNewton::SetElasticityCombMode(ePhysicsMaterialCombMode aMode)
	{
		mElasticityMode = aMode;

		UpdateMaterials();
	}
	void cPhysicsMaterialNewton::SetFrictionCombMode(ePhysicsMaterialCombMode aMode)
	{
		mFrictionMode = aMode;

		UpdateMaterials();
	}