Browse Source

Remove portals & sectors

Panagiotis Christopoulos Charitos 7 years ago
parent
commit
612893f358

+ 0 - 1
src/anki/Scene.h

@@ -6,7 +6,6 @@
 #pragma once
 #pragma once
 
 
 #include <anki/scene/SceneGraph.h>
 #include <anki/scene/SceneGraph.h>
-#include <anki/scene/SectorNode.h>
 #include <anki/scene/ModelNode.h>
 #include <anki/scene/ModelNode.h>
 #include <anki/scene/StaticGeometryNode.h>
 #include <anki/scene/StaticGeometryNode.h>
 #include <anki/scene/ParticleEmitterNode.h>
 #include <anki/scene/ParticleEmitterNode.h>

+ 0 - 4
src/anki/scene/Forward.h

@@ -17,8 +17,6 @@ class RenderComponent;
 class MaterialRenderComponent;
 class MaterialRenderComponent;
 class SpatialComponent;
 class SpatialComponent;
 class DecalComponent;
 class DecalComponent;
-class PortalComponent;
-class SectorComponent;
 class ReflectionProxyComponent;
 class ReflectionProxyComponent;
 class ReflectionProbeComponent;
 class ReflectionProbeComponent;
 
 
@@ -28,8 +26,6 @@ class LightNode;
 class PointLightNode;
 class PointLightNode;
 class SpotLightNode;
 class SpotLightNode;
 class CameraNode;
 class CameraNode;
-class SectorNode;
-class PortalNode;
 
 
 // Other
 // Other
 class SceneGraph;
 class SceneGraph;

+ 0 - 9
src/anki/scene/SceneGraph.cpp

@@ -7,7 +7,6 @@
 #include <anki/scene/CameraNode.h>
 #include <anki/scene/CameraNode.h>
 #include <anki/scene/PhysicsDebugNode.h>
 #include <anki/scene/PhysicsDebugNode.h>
 #include <anki/scene/ModelNode.h>
 #include <anki/scene/ModelNode.h>
-#include <anki/scene/SectorNode.h>
 #include <anki/scene/Octree.h>
 #include <anki/scene/Octree.h>
 #include <anki/core/Trace.h>
 #include <anki/core/Trace.h>
 #include <anki/physics/PhysicsWorld.h>
 #include <anki/physics/PhysicsWorld.h>
@@ -58,12 +57,6 @@ SceneGraph::~SceneGraph()
 
 
 	deleteNodesMarkedForDeletion();
 	deleteNodesMarkedForDeletion();
 
 
-	if(m_sectors)
-	{
-		m_alloc.deleteInstance(m_sectors);
-		m_sectors = nullptr;
-	}
-
 	if(m_octree)
 	if(m_octree)
 	{
 	{
 		m_alloc.deleteInstance(m_octree);
 		m_alloc.deleteInstance(m_octree);
@@ -97,8 +90,6 @@ Error SceneGraph::init(AllocAlignedCallback allocCb,
 
 
 	ANKI_CHECK(m_events.init(this));
 	ANKI_CHECK(m_events.init(this));
 
 
-	m_sectors = m_alloc.newInstance<SectorGroup>(this);
-
 	m_maxReflectionProxyDistance = config.getNumber("scene.imageReflectionMaxDistance");
 	m_maxReflectionProxyDistance = config.getNumber("scene.imageReflectionMaxDistance");
 
 
 	m_octree = m_alloc.newInstance<Octree>(m_alloc);
 	m_octree = m_alloc.newInstance<Octree>(m_alloc);

+ 0 - 8
src/anki/scene/SceneGraph.h

@@ -22,7 +22,6 @@ class MainRenderer;
 class ResourceManager;
 class ResourceManager;
 class CameraNode;
 class CameraNode;
 class Input;
 class Input;
-class SectorGroup;
 class ConfigSet;
 class ConfigSet;
 class PerspectiveCameraNode;
 class PerspectiveCameraNode;
 class UpdateSceneNodesCtx;
 class UpdateSceneNodesCtx;
@@ -210,12 +209,6 @@ anki_internal:
 		return *m_input;
 		return *m_input;
 	}
 	}
 
 
-	SectorGroup& getSectorGroup()
-	{
-		ANKI_ASSERT(m_sectors);
-		return *m_sectors;
-	}
-
 	F32 getMaxReflectionProxyDistance() const
 	F32 getMaxReflectionProxyDistance() const
 	{
 	{
 		ANKI_ASSERT(m_maxReflectionProxyDistance > 0.0);
 		ANKI_ASSERT(m_maxReflectionProxyDistance > 0.0);
@@ -268,7 +261,6 @@ private:
 	PerspectiveCameraNode* m_defaultMainCam = nullptr;
 	PerspectiveCameraNode* m_defaultMainCam = nullptr;
 
 
 	EventManager m_events;
 	EventManager m_events;
-	SectorGroup* m_sectors;
 
 
 	Octree* m_octree = nullptr;
 	Octree* m_octree = nullptr;
 
 

+ 0 - 15
src/anki/scene/SceneNode.h

@@ -93,7 +93,6 @@ public:
 
 
 	ANKI_USE_RESULT Error frameUpdateComplete(Second prevUpdateTime, Second crntTime, Timestamp maxComponentTimestamp)
 	ANKI_USE_RESULT Error frameUpdateComplete(Second prevUpdateTime, Second crntTime, Timestamp maxComponentTimestamp)
 	{
 	{
-		m_sectorVisitedBitset.unsetAll();
 		m_maxComponentTimestamp = maxComponentTimestamp;
 		m_maxComponentTimestamp = maxComponentTimestamp;
 		if(m_components.getSize() > 0)
 		if(m_components.getSize() > 0)
 		{
 		{
@@ -102,16 +101,6 @@ public:
 		return frameUpdate(prevUpdateTime, crntTime);
 		return frameUpdate(prevUpdateTime, crntTime);
 	}
 	}
 
 
-	/// Inform if a sector has visited this node.
-	/// @return The previous value.
-	Bool fetchSetSectorVisited(U testId, Bool visited)
-	{
-		LockGuard<SpinLock> lock(m_sectorVisitedBitsetLock);
-		Bool prevValue = m_sectorVisitedBitset.get(testId);
-		m_sectorVisitedBitset.set(testId, visited);
-		return prevValue;
-	}
-
 	/// Iterate all components
 	/// Iterate all components
 	template<typename Func>
 	template<typename Func>
 	ANKI_USE_RESULT Error iterateComponents(Func func) const
 	ANKI_USE_RESULT Error iterateComponents(Func func) const
@@ -243,10 +232,6 @@ private:
 	String m_name; ///< A unique name
 	String m_name; ///< A unique name
 	BitMask<Flag> m_flags;
 	BitMask<Flag> m_flags;
 
 
-	/// A mask of bits for each test. If bit set then the node was visited by a sector.
-	BitSet<256> m_sectorVisitedBitset = {false};
-	SpinLock m_sectorVisitedBitsetLock;
-
 	U64 m_uuid;
 	U64 m_uuid;
 
 
 	Timestamp m_maxComponentTimestamp = 0;
 	Timestamp m_maxComponentTimestamp = 0;

+ 0 - 647
src/anki/scene/SectorNode.cpp

@@ -1,647 +0,0 @@
-// Copyright (C) 2009-2018, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <anki/scene/SectorNode.h>
-#include <anki/scene/components/SectorComponent.h>
-#include <anki/scene/components/SpatialComponent.h>
-#include <anki/scene/components/FrustumComponent.h>
-#include <anki/scene/components/MoveComponent.h>
-#include <anki/scene/SceneGraph.h>
-#include <anki/scene/SoftwareRasterizer.h>
-#include <anki/util/Logger.h>
-#include <anki/resource/ResourceManager.h>
-#include <anki/resource/MeshLoader.h>
-
-namespace anki
-{
-
-template<typename TFunc>
-static void iterateSceneSectors(SceneGraph& scene, TFunc func)
-{
-	scene.getSceneComponentLists().iterateComponents<SectorComponent>([&](SectorComponent& comp) {
-		SectorNode& s = static_cast<SectorNode&>(comp.getSceneNode());
-		if(func(s))
-		{
-			return;
-		}
-	});
-}
-
-template<typename TFunc>
-static void iterateScenePortals(SceneGraph& scene, TFunc func)
-{
-	scene.getSceneComponentLists().iterateComponents<PortalComponent>([&](PortalComponent& comp) {
-		PortalNode& s = static_cast<PortalNode&>(comp.getSceneNode());
-		if(func(s))
-		{
-			return;
-		}
-	});
-}
-
-PortalSectorBase::~PortalSectorBase()
-{
-	auto alloc = getSceneAllocator();
-
-	if(m_shape)
-	{
-		alloc.deleteInstance(m_shape);
-		m_shape = nullptr;
-	}
-
-	m_shapeStorageLSpace.destroy(alloc);
-	m_shapeStorageWSpace.destroy(alloc);
-	m_vertIndices.destroy(alloc);
-}
-
-Error PortalSectorBase::init(const CString& meshFname, Bool isSector)
-{
-	// Create move component
-	newComponent<MoveComponent>();
-
-	// Create portal or sector component
-	if(isSector)
-	{
-		newComponent<SectorComponent>();
-	}
-	else
-	{
-		newComponent<PortalComponent>();
-	}
-
-	// Load mesh
-	MeshLoader loader(&getSceneGraph().getResourceManager());
-	ANKI_CHECK(loader.load(meshFname));
-
-	DynamicArrayAuto<U32> indices(getSceneAllocator());
-	DynamicArrayAuto<Vec3> positions(getSceneAllocator());
-
-	ANKI_CHECK(loader.storeIndicesAndPosition(indices, positions));
-
-	// Convert Vec3 positions to Vec4
-	m_shapeStorageLSpace.create(getSceneAllocator(), positions.getSize());
-	m_shapeStorageWSpace.create(getSceneAllocator(), positions.getSize());
-
-	for(U i = 0; i < positions.getSize(); ++i)
-	{
-		m_shapeStorageLSpace[i] = Vec4(positions[i], 0.0f);
-	}
-
-	// Create shape
-	ConvexHullShape* hull = getSceneAllocator().newInstance<ConvexHullShape>();
-	m_shape = hull;
-	hull->initStorage(&m_shapeStorageWSpace[0], m_shapeStorageWSpace.getSize());
-	updateTransform(Transform::getIdentity());
-
-	// Store indices
-	m_vertIndices.create(getSceneAllocator(), indices.getSize());
-	for(U i = 0; i < indices.getSize(); ++i)
-	{
-		m_vertIndices[i] = indices[i];
-	}
-
-	return Error::NONE;
-}
-
-void PortalSectorBase::updateTransform(const Transform& trf)
-{
-	const U count = m_shapeStorageWSpace.getSize();
-	for(U i = 0; i < count; ++i)
-	{
-		m_shapeStorageWSpace[i] = trf.transform(m_shapeStorageLSpace[i]);
-	}
-
-	m_shape->computeAabb(m_aabb);
-}
-
-PortalNode::~PortalNode()
-{
-	auto alloc = getSceneAllocator();
-
-	// Remove from sectors
-	for(SectorNode* s : m_sectors)
-	{
-		s->tryRemovePortal(this);
-	}
-
-	m_sectors.destroy(getSceneAllocator());
-}
-
-Error PortalNode::init(const CString& meshFname)
-{
-	ANKI_CHECK(Base::init(meshFname, false));
-	return Error::NONE;
-}
-
-Error PortalNode::frameUpdate(Second prevUpdateTime, Second crntTime)
-{
-	MoveComponent& move = getComponent<MoveComponent>();
-	if(move.getTimestamp() == getGlobalTimestamp())
-	{
-		// Move comp updated
-		updateTransform(move.getWorldTransform());
-		getSceneGraph().getSectorGroup().portalUpdated(this);
-	}
-
-	return Error::NONE;
-}
-
-void PortalNode::deferredUpdate()
-{
-	// Gather the sectors it collides
-	iterateSceneSectors(getSceneGraph(), [&](SectorNode& sector) -> Bool {
-		Bool collide = testCollisionShapes(m_aabb, sector.m_aabb);
-
-		// Perform a more detailed test
-		if(collide)
-		{
-			collide = testCollisionShapes(*m_shape, sector.getBoundingShape());
-		}
-
-		// Update graphs
-		if(collide)
-		{
-			tryAddSector(&sector);
-			sector.tryAddPortal(this);
-		}
-		else
-		{
-			tryRemoveSector(&sector);
-			sector.tryRemovePortal(this);
-		}
-
-		return false;
-	});
-}
-
-void PortalNode::tryAddSector(SectorNode* sector)
-{
-	ANKI_ASSERT(sector);
-
-	auto it = m_sectors.getBegin();
-	auto end = m_sectors.getEnd();
-	for(; it != end; ++it)
-	{
-		if(*it == sector)
-		{
-			// Already there, return
-			return;
-		}
-	}
-
-	m_sectors.pushBack(getSceneAllocator(), sector);
-}
-
-void PortalNode::tryRemoveSector(SectorNode* sector)
-{
-	ANKI_ASSERT(sector);
-
-	auto it = m_sectors.getBegin();
-	auto end = m_sectors.getEnd();
-	for(; it != end; ++it)
-	{
-		if(*it == sector)
-		{
-			m_sectors.erase(getSceneAllocator(), it);
-			break;
-		}
-	}
-}
-
-SectorNode::~SectorNode()
-{
-	auto alloc = getSceneAllocator();
-
-	// Remove portals
-	for(PortalNode* p : m_portals)
-	{
-		p->tryRemoveSector(this);
-	}
-
-	m_portals.destroy(alloc);
-
-	// Remove spatials
-	U spatialsCount = m_spatials.getSize();
-	while(spatialsCount-- != 0) // Use counter
-	{
-		tryRemoveSpatialComponent(m_spatials.getFront());
-	}
-}
-
-Error SectorNode::init(const CString& meshFname)
-{
-	ANKI_CHECK(PortalSectorBase::init(meshFname, true));
-	return Error::NONE;
-}
-
-void SectorNode::tryAddPortal(PortalNode* portal)
-{
-	ANKI_ASSERT(portal);
-
-	auto it = m_portals.getBegin();
-	auto end = m_portals.getEnd();
-	for(; it != end; ++it)
-	{
-		if(*it == portal)
-		{
-			// Already there, return
-			return;
-		}
-	}
-
-	m_portals.pushBack(getSceneAllocator(), portal);
-}
-
-void SectorNode::tryRemovePortal(PortalNode* portal)
-{
-	ANKI_ASSERT(portal);
-
-	auto it = m_portals.getBegin();
-	auto end = m_portals.getEnd();
-	for(; it != end; ++it)
-	{
-		if(*it == portal)
-		{
-			m_portals.erase(getSceneAllocator(), it);
-			break;
-		}
-	}
-}
-
-void SectorNode::tryAddSpatialComponent(SpatialComponent* sp)
-{
-	ANKI_ASSERT(sp);
-
-	// Find sector in spatial
-	auto itsp = sp->getSectorInfo().getBegin();
-	auto endsp = sp->getSectorInfo().getEnd();
-	for(; itsp != endsp; ++itsp)
-	{
-		if(*itsp == this)
-		{
-			// Found, return
-			ANKI_ASSERT(
-				findSpatialComponent(sp) != m_spatials.getEnd() && "Spatial has reference to sector but sector not");
-			return;
-		}
-	}
-
-	ANKI_ASSERT(findSpatialComponent(sp) == m_spatials.getEnd());
-
-	m_spatials.pushBack(getSceneAllocator(), sp);
-	sp->getSectorInfo().pushBack(getSceneAllocator(), this);
-}
-
-void SectorNode::tryRemoveSpatialComponent(SpatialComponent* sp)
-{
-	ANKI_ASSERT(sp);
-
-	// Find sector in spatial
-	auto itsp = sp->getSectorInfo().getBegin();
-	auto endsp = sp->getSectorInfo().getEnd();
-	for(; itsp != endsp; ++itsp)
-	{
-		if(*itsp == this)
-		{
-			break;
-		}
-	}
-
-	if(itsp != endsp)
-	{
-		// Found, remove
-
-		sp->getSectorInfo().erase(getSceneAllocator(), itsp);
-
-		auto it = findSpatialComponent(sp);
-		ANKI_ASSERT(it != m_spatials.getEnd());
-		m_spatials.erase(getSceneAllocator(), it);
-	}
-	else
-	{
-#if ANKI_EXTRA_CHECKS
-		ANKI_ASSERT(findSpatialComponent(sp) == m_spatials.getEnd());
-#endif
-	}
-}
-
-List<SpatialComponent*>::Iterator SectorNode::findSpatialComponent(SpatialComponent* sp)
-{
-	ANKI_ASSERT(sp);
-	auto it = m_spatials.getBegin();
-	auto end = m_spatials.getEnd();
-	for(; it != end; ++it)
-	{
-		if(*it == sp)
-		{
-			break;
-		}
-	}
-
-	return it;
-}
-
-Error SectorNode::frameUpdate(Second prevUpdateTime, Second crntTime)
-{
-	MoveComponent& move = getComponent<MoveComponent>();
-	if(move.getTimestamp() == getGlobalTimestamp())
-	{
-		// Move comp updated.
-		updateTransform(move.getWorldTransform());
-		getSceneGraph().getSectorGroup().sectorUpdated(this);
-	}
-
-	return Error::NONE;
-}
-
-void SectorNode::deferredUpdate()
-{
-	// Spatials should get updated
-	for(SpatialComponent* sp : m_spatials)
-	{
-		sp->markForUpdate();
-	}
-
-	iterateScenePortals(getSceneGraph(), [&](PortalNode& portal) -> Bool {
-		Bool collide = testCollisionShapes(m_aabb, portal.m_aabb);
-
-		if(collide)
-		{
-			collide = testCollisionShapes(*m_shape, portal.getBoundingShape());
-		}
-
-		if(collide)
-		{
-			portal.tryAddSector(this);
-			tryAddPortal(&portal);
-		}
-		else
-		{
-			portal.tryRemoveSector(this);
-			tryRemovePortal(&portal);
-		}
-
-		return false;
-	});
-}
-
-SectorGroup::~SectorGroup()
-{
-}
-
-void SectorGroup::spatialUpdated(SpatialComponent* sp)
-{
-	ANKI_ASSERT(sp);
-	LockGuard<SpinLock> lock(m_mtx);
-	m_spatialsDeferredBinning.pushBack(m_scene->getFrameAllocator(), sp);
-}
-
-void SectorGroup::portalUpdated(PortalNode* portal)
-{
-	ANKI_ASSERT(portal);
-	LockGuard<SpinLock> lock(m_portalsUpdatedLock);
-	m_portalsUpdated.pushBack(m_scene->getFrameAllocator(), portal);
-}
-
-void SectorGroup::sectorUpdated(SectorNode* sector)
-{
-	ANKI_ASSERT(sector);
-	LockGuard<SpinLock> lock(m_sectorsUpdatedLock);
-	m_sectorsUpdated.pushBack(m_scene->getFrameAllocator(), sector);
-}
-
-void SectorGroup::binSpatial(SpatialComponent* sp)
-{
-	ANKI_ASSERT(sp);
-
-	// Iterate all sectors and bin the spatial
-	iterateSceneSectors(*m_scene, [&](SectorNode& sector) -> Bool {
-		Bool collide = false;
-		if(!sp->getSingleSector())
-		{
-			// Spatial can belong to multiple sectors
-
-			// Fast test
-			collide = testCollisionShapes(sector.m_aabb, sp->getAabb());
-
-			// Detailed test
-			if(collide)
-			{
-				collide = testCollisionShapes(sector.getBoundingShape(), sp->getSpatialCollisionShape());
-			}
-		}
-		else
-		{
-			// Spatial can belong to one sector
-
-			// Make sure the origin of the spatial is inside the sector
-			const Vec4& center = sp->getSpatialOrigin();
-
-			if(center >= sector.m_aabb.getMin() && center <= sector.m_aabb.getMax())
-			{
-				collide = true;
-			}
-
-			// Detailed test
-			const F32 smallf = EPSILON * 10.0;
-			Aabb smallBox(center, center + Vec4(smallf, smallf, smallf, 0.0));
-			if(collide)
-			{
-				collide = testCollisionShapes(sector.getBoundingShape(), smallBox);
-			}
-		}
-
-		if(collide)
-		{
-			sector.tryAddSpatialComponent(sp);
-		}
-		else
-		{
-			sector.tryRemoveSpatialComponent(sp);
-		}
-
-		return false;
-	});
-}
-
-void SectorGroup::spatialDeleted(SpatialComponent* sp)
-{
-	auto it = sp->getSectorInfo().getBegin();
-	auto end = sp->getSectorInfo().getEnd();
-	while(it != end)
-	{
-		(*it)->tryRemoveSpatialComponent(sp);
-		++it;
-	}
-}
-
-void SectorGroup::findVisibleSectors(const FrustumComponent& frc,
-	const SoftwareRasterizer* r,
-	List<const SectorNode*>& visibleSectors,
-	U& spatialsCount) const
-{
-	// Find the sector the eye is in
-	Sphere eye(frc.getFrustumOrigin(), frc.getFrustum().getNear());
-	Bool eyeInsideASector = false;
-	SectorNode* sectorEyeIsInside = nullptr;
-
-	iterateSceneSectors(*m_scene, [&](SectorNode& sector) -> Bool {
-		Bool collide = testCollisionShapes(eye, sector.m_aabb);
-
-		if(collide)
-		{
-			collide = testCollisionShapes(eye, sector.getBoundingShape());
-		}
-
-		if(collide)
-		{
-			eyeInsideASector = true;
-			sectorEyeIsInside = &sector;
-			return true;
-		}
-
-		return false;
-	});
-
-	if(!eyeInsideASector)
-	{
-		// eye outside all sectors, find those the frustum collides
-
-		iterateSceneSectors(*m_scene, [&](SectorNode& sector) -> Bool {
-			if(frc.insideFrustum(sector.getBoundingShape()))
-			{
-				findVisibleSectorsInternal(frc, sector, r, visibleSectors, spatialsCount);
-			}
-
-			return false;
-		});
-	}
-	else
-	{
-		// eye inside a sector
-		findVisibleSectorsInternal(frc, *sectorEyeIsInside, r, visibleSectors, spatialsCount);
-	}
-}
-
-void SectorGroup::findVisibleSectorsInternal(const FrustumComponent& frc,
-	const SectorNode& s,
-	const SoftwareRasterizer* r,
-	List<const SectorNode*>& visibleSectors,
-	U& spatialsCount) const
-{
-	auto alloc = m_scene->getFrameAllocator();
-
-	// Check if "s" is already there
-	auto it = visibleSectors.getBegin();
-	auto end = visibleSectors.getEnd();
-	for(; it != end; ++it)
-	{
-		if(*it == &s)
-		{
-			// SectorNode already there, skip
-			return;
-		}
-	}
-
-	// SectorNode not in the list, push it
-	visibleSectors.pushBack(alloc, &s);
-	spatialsCount += s.m_spatials.getSize();
-
-	// Check visible portals
-	auto itp = s.m_portals.getBegin();
-	auto itend = s.m_portals.getEnd();
-	for(; itp != itend; ++itp)
-	{
-		const PortalNode& p = *(*itp);
-
-		if(frc.insideFrustum(p.getBoundingShape())
-			&& (r == nullptr || r->visibilityTest(p.getBoundingShape(), p.m_aabb)))
-		{
-			auto it = p.m_sectors.getBegin();
-			auto end = p.m_sectors.getEnd();
-			for(; it != end; ++it)
-			{
-				if(*it != &s)
-				{
-					findVisibleSectorsInternal(frc, *(*it), r, visibleSectors, spatialsCount);
-				}
-			}
-		}
-	}
-}
-
-void SectorGroup::prepareForVisibilityTests()
-{
-	// Update portals
-	Error err = m_portalsUpdated.iterateForward([](PortalNode* portal) {
-		portal->deferredUpdate();
-		return Error::NONE;
-	});
-	(void)err;
-	m_portalsUpdated.destroy(m_scene->getFrameAllocator());
-
-	// Update sectors
-	err = m_sectorsUpdated.iterateForward([](SectorNode* portal) {
-		portal->deferredUpdate();
-		return Error::NONE;
-	});
-	(void)err;
-	m_sectorsUpdated.destroy(m_scene->getFrameAllocator());
-
-	// Bin spatials
-	err = m_spatialsDeferredBinning.iterateForward([this](SpatialComponent* spc) {
-		binSpatial(spc);
-		return Error::NONE;
-	});
-	(void)err;
-	m_spatialsDeferredBinning.destroy(m_scene->getFrameAllocator());
-}
-
-void SectorGroup::findVisibleNodes(
-	const FrustumComponent& frc, U testId, const SoftwareRasterizer* r, SectorGroupVisibilityTestsContext& ctx) const
-{
-	auto alloc = m_scene->getFrameAllocator();
-
-	// Find visible sectors
-	ListAuto<const SectorNode*> visSectors(alloc);
-	U spatialsCount = 0;
-	findVisibleSectors(frc, r, visSectors, spatialsCount);
-
-	if(ANKI_UNLIKELY(spatialsCount == 0))
-	{
-		return;
-	}
-
-	// Initiate storage of nodes
-	SceneNode** visibleNodesMem = reinterpret_cast<SceneNode**>(alloc.allocate(spatialsCount * sizeof(void*)));
-
-	WeakArray<SceneNode*> visibleNodes(visibleNodesMem, spatialsCount);
-
-	// Iterate visible sectors and get the scene nodes. The array will contain
-	// duplicates
-	U nodesCount = 0;
-	auto it = visSectors.getBegin();
-	auto end = visSectors.getEnd();
-	for(; it != end; ++it)
-	{
-		const SectorNode& s = *(*it);
-		for(auto itsp : s.m_spatials)
-		{
-			const SpatialComponent& spc = *itsp;
-			SceneNode& node = const_cast<SceneNode&>(spc.getSceneNode());
-
-			// Check if alrady visited
-			if(!node.fetchSetSectorVisited(testId, true))
-			{
-				visibleNodes[nodesCount++] = &node;
-			}
-		}
-	}
-
-	// Update the context
-	ctx.m_visibleNodes = WeakArray<SceneNode*>(visibleNodesMem, nodesCount);
-}
-
-} // end namespace anki

+ 0 - 212
src/anki/scene/SectorNode.h

@@ -1,212 +0,0 @@
-// Copyright (C) 2009-2018, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/scene/SceneNode.h>
-#include <anki/scene/components/SceneComponent.h>
-#include <anki/Collision.h>
-#include <anki/util/WeakArray.h>
-
-namespace anki
-{
-
-// Forward
-class SectorGroup;
-class Renderer;
-class SoftwareRasterizer;
-
-/// @addtogroup scene
-/// @{
-
-/// The base for portals and sectors.
-class PortalSectorBase : public SceneNode
-{
-	friend class PortalNode;
-	friend class SectorNode;
-
-public:
-	PortalSectorBase(SceneGraph* scene, CString name)
-		: SceneNode(scene, name)
-	{
-	}
-
-	~PortalSectorBase();
-
-	ANKI_USE_RESULT Error init(const CString& modelFname, Bool isSector);
-
-	const CollisionShape& getBoundingShape() const
-	{
-		return *m_shape;
-	}
-
-	SectorGroup& getSectorGroup();
-
-	const DynamicArray<Vec4>& getVertices() const
-	{
-		return m_shapeStorageLSpace;
-	}
-
-	const DynamicArray<U16>& getVertexIndices() const
-	{
-		return m_vertIndices;
-	}
-
-protected:
-	DynamicArray<Vec4> m_shapeStorageLSpace;
-	DynamicArray<Vec4> m_shapeStorageWSpace;
-	CollisionShape* m_shape = nullptr;
-	Aabb m_aabb;
-	DynamicArray<U16> m_vertIndices; ///< Used in debug draw
-
-	void updateTransform(const Transform& trf);
-};
-
-/// 2 way portal.
-class PortalNode : public PortalSectorBase
-{
-	friend class SectorGroup;
-
-public:
-	using Base = PortalSectorBase;
-
-	PortalNode(SceneGraph* scene, CString name)
-		: PortalSectorBase(scene, name)
-	{
-	}
-
-	~PortalNode();
-
-	ANKI_USE_RESULT Error init(const CString& modelFname);
-
-	ANKI_USE_RESULT Error frameUpdate(Second prevUpdateTime, Second crntTime) override;
-
-	/// Add reference to sector.
-	void tryAddSector(SectorNode* sector);
-
-	/// Remove reference from sector.
-	void tryRemoveSector(SectorNode* sector);
-
-	void deferredUpdate();
-
-private:
-	List<SectorNode*> m_sectors;
-};
-
-/// A sector. It consists of an octree and some portals
-class SectorNode : public PortalSectorBase
-{
-	friend class SectorGroup;
-
-public:
-	using Base = PortalSectorBase;
-
-	/// Default constructor
-	SectorNode(SceneGraph* scene, CString name)
-		: Base(scene, name)
-	{
-	}
-
-	~SectorNode();
-
-	ANKI_USE_RESULT Error init(const CString& modelFname);
-
-	void tryAddPortal(PortalNode* portal);
-	void tryRemovePortal(PortalNode* portal);
-
-	void tryAddSpatialComponent(SpatialComponent* sp);
-	void tryRemoveSpatialComponent(SpatialComponent* sp);
-
-	ANKI_USE_RESULT Error frameUpdate(Second prevUpdateTime, Second crntTime) override;
-
-	void deferredUpdate();
-
-private:
-	List<PortalNode*> m_portals;
-	List<SpatialComponent*> m_spatials;
-
-	List<SpatialComponent*>::Iterator findSpatialComponent(SpatialComponent* sp);
-};
-
-/// The context for visibility tests from a single FrustumComponent (not for all of them).
-class SectorGroupVisibilityTestsContext
-{
-	friend class SectorGroup;
-
-public:
-	U getVisibleSceneNodeCount() const
-	{
-		return m_visibleNodes.getSize();
-	}
-
-	template<typename Func>
-	void iterateVisibleSceneNodes(PtrSize begin, PtrSize end, Func func)
-	{
-		ANKI_ASSERT(begin <= end);
-
-		for(U i = begin; i < end; ++i)
-		{
-			func(*m_visibleNodes[i]);
-		}
-	}
-
-private:
-	WeakArray<SceneNode*> m_visibleNodes;
-};
-
-/// Sector group. This is supposed to represent the whole scene
-class SectorGroup
-{
-public:
-	/// Default constructor
-	SectorGroup(SceneGraph* scene)
-		: m_scene(scene)
-	{
-	}
-
-	/// Destructor
-	~SectorGroup();
-
-	void spatialUpdated(SpatialComponent* sp);
-	void spatialDeleted(SpatialComponent* sp);
-
-	void portalUpdated(PortalNode* portal);
-	void sectorUpdated(SectorNode* sector);
-
-	void prepareForVisibilityTests();
-
-	void findVisibleNodes(const FrustumComponent& frc,
-		U threadId,
-		const SoftwareRasterizer* r,
-		SectorGroupVisibilityTestsContext& ctx) const;
-
-private:
-	SceneGraph* m_scene; ///< Keep it here to access various allocators
-
-	List<SpatialComponent*> m_spatialsDeferredBinning;
-	SpinLock m_mtx;
-
-	List<PortalNode*> m_portalsUpdated;
-	SpinLock m_portalsUpdatedLock;
-	List<SectorNode*> m_sectorsUpdated;
-	SpinLock m_sectorsUpdatedLock;
-
-	void findVisibleSectors(const FrustumComponent& frc,
-		const SoftwareRasterizer* r,
-		List<const SectorNode*>& visibleSectors,
-		U& spatialsCount) const;
-
-	/// Recursive method
-	void findVisibleSectorsInternal(const FrustumComponent& frc,
-		const SectorNode& s,
-		const SoftwareRasterizer* r,
-		List<const SectorNode*>& visibleSectors,
-		U& spatialsCount) const;
-
-	void binSpatial(SpatialComponent* sp);
-};
-/// @}
-
-} // end namespace anki

+ 0 - 2
src/anki/scene/Visibility.cpp

@@ -5,7 +5,6 @@
 
 
 #include <anki/scene/VisibilityInternal.h>
 #include <anki/scene/VisibilityInternal.h>
 #include <anki/scene/SceneGraph.h>
 #include <anki/scene/SceneGraph.h>
-#include <anki/scene/SectorNode.h>
 #include <anki/scene/components/FrustumComponent.h>
 #include <anki/scene/components/FrustumComponent.h>
 #include <anki/scene/components/LensFlareComponent.h>
 #include <anki/scene/components/LensFlareComponent.h>
 #include <anki/scene/components/RenderComponent.h>
 #include <anki/scene/components/RenderComponent.h>
@@ -678,7 +677,6 @@ void SceneGraph::doVisibilityTests(SceneNode& fsn, SceneGraph& scene, RenderQueu
 	ANKI_TRACE_SCOPED_EVENT(SCENE_VIS_TESTS);
 	ANKI_TRACE_SCOPED_EVENT(SCENE_VIS_TESTS);
 
 
 	ThreadHive& hive = scene.getThreadHive();
 	ThreadHive& hive = scene.getThreadHive();
-	scene.getSectorGroup().prepareForVisibilityTests();
 
 
 	VisibilityContext ctx;
 	VisibilityContext ctx;
 	ctx.m_scene = &scene;
 	ctx.m_scene = &scene;

+ 0 - 1
src/anki/scene/VisibilityInternal.h

@@ -5,7 +5,6 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <anki/scene/SectorNode.h>
 #include <anki/scene/SceneGraph.h>
 #include <anki/scene/SceneGraph.h>
 #include <anki/scene/SoftwareRasterizer.h>
 #include <anki/scene/SoftwareRasterizer.h>
 #include <anki/scene/components/FrustumComponent.h>
 #include <anki/scene/components/FrustumComponent.h>

+ 0 - 2
src/anki/scene/components/SceneComponent.h

@@ -27,8 +27,6 @@ enum class SceneComponentType : U16
 	LIGHT,
 	LIGHT,
 	LENS_FLARE,
 	LENS_FLARE,
 	BODY,
 	BODY,
-	SECTOR,
-	PORTAL,
 	REFLECTION_PROBE,
 	REFLECTION_PROBE,
 	REFLECTION_PROXY,
 	REFLECTION_PROXY,
 	OCCLUDER,
 	OCCLUDER,

+ 0 - 41
src/anki/scene/components/SectorComponent.h

@@ -1,41 +0,0 @@
-// Copyright (C) 2009-2018, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/scene/components/SceneComponent.h>
-
-namespace anki
-{
-
-/// @addtogroup scene
-/// @{
-
-/// Dummy component to identify a portal.
-class PortalComponent : public SceneComponent
-{
-public:
-	static const SceneComponentType CLASS_TYPE = SceneComponentType::PORTAL;
-
-	PortalComponent(SceneNode* node)
-		: SceneComponent(CLASS_TYPE, node)
-	{
-	}
-};
-
-/// Dummy component to identify a sector.
-class SectorComponent : public SceneComponent
-{
-public:
-	static const SceneComponentType CLASS_TYPE = SceneComponentType::SECTOR;
-
-	SectorComponent(SceneNode* node)
-		: SceneComponent(CLASS_TYPE, node)
-	{
-	}
-};
-/// @}
-
-} // end namespace anki

+ 0 - 4
src/anki/scene/components/SpatialComponent.cpp

@@ -5,7 +5,6 @@
 
 
 #include <anki/scene/components/SpatialComponent.h>
 #include <anki/scene/components/SpatialComponent.h>
 #include <anki/scene/SceneNode.h>
 #include <anki/scene/SceneNode.h>
-#include <anki/scene/SectorNode.h>
 #include <anki/scene/SceneGraph.h>
 #include <anki/scene/SceneGraph.h>
 
 
 namespace anki
 namespace anki
@@ -22,8 +21,6 @@ SpatialComponent::SpatialComponent(SceneNode* node, const CollisionShape* shape)
 
 
 SpatialComponent::~SpatialComponent()
 SpatialComponent::~SpatialComponent()
 {
 {
-	getSceneGraph().getSectorGroup().spatialDeleted(this);
-
 	if(m_placed)
 	if(m_placed)
 	{
 	{
 		getSceneGraph().getOctree().remove(m_octreeInfo);
 		getSceneGraph().getOctree().remove(m_octreeInfo);
@@ -36,7 +33,6 @@ Error SpatialComponent::update(Second, Second, Bool& updated)
 	if(updated)
 	if(updated)
 	{
 	{
 		m_shape->computeAabb(m_aabb);
 		m_shape->computeAabb(m_aabb);
-		getSceneGraph().getSectorGroup().spatialUpdated(this);
 		m_markedForUpdate = false;
 		m_markedForUpdate = false;
 
 
 		getSceneGraph().getOctree().place(m_aabb, &m_octreeInfo);
 		getSceneGraph().getOctree().place(m_aabb, &m_octreeInfo);

+ 1 - 19
src/anki/scene/components/SpatialComponent.h

@@ -18,8 +18,7 @@ namespace anki
 /// @addtogroup scene
 /// @addtogroup scene
 /// @{
 /// @{
 
 
-/// Spatial component for scene nodes. It indicates scene nodes that need to be placed in the a sector and they
-/// participate in the visibility tests.
+/// Spatial component for scene nodes. It is used by scene nodes that need to be placed in the visibility structures.
 class SpatialComponent : public SceneComponent
 class SpatialComponent : public SceneComponent
 {
 {
 public:
 public:
@@ -39,16 +38,6 @@ public:
 		return m_aabb;
 		return m_aabb;
 	}
 	}
 
 
-	List<SectorNode*>& getSectorInfo()
-	{
-		return m_sectorInfo;
-	}
-
-	const List<SectorNode*>& getSectorInfo() const
-	{
-		return m_sectorInfo;
-	}
-
 	/// Get optimal collision shape for visibility tests
 	/// Get optimal collision shape for visibility tests
 	const CollisionShape& getVisibilityCollisionShape()
 	const CollisionShape& getVisibilityCollisionShape()
 	{
 	{
@@ -63,12 +52,6 @@ public:
 		}
 		}
 	}
 	}
 
 
-	/// Check if it's confined in a single sector.
-	Bool getSingleSector() const
-	{
-		return false;
-	}
-
 	/// Used for sorting spatials. In most object the origin is the center of mass but for cameras the origin is the
 	/// Used for sorting spatials. In most object the origin is the center of mass but for cameras the origin is the
 	/// eye point.
 	/// eye point.
 	const Vec4& getSpatialOrigin() const
 	const Vec4& getSpatialOrigin() const
@@ -100,7 +83,6 @@ private:
 	const CollisionShape* m_shape;
 	const CollisionShape* m_shape;
 	Aabb m_aabb; ///< A faster shape
 	Aabb m_aabb; ///< A faster shape
 	Vec4 m_origin = Vec4(MAX_F32, MAX_F32, MAX_F32, 0.0);
 	Vec4 m_origin = Vec4(MAX_F32, MAX_F32, MAX_F32, 0.0);
-	List<SectorNode*> m_sectorInfo;
 
 
 	OctreePlaceable m_octreeInfo;
 	OctreePlaceable m_octreeInfo;
 };
 };

+ 0 - 266
src/anki/script/Scene.cpp

@@ -2419,140 +2419,6 @@ static inline void wrapStaticCollisionNode(lua_State* l)
 	lua_settop(l, 0);
 	lua_settop(l, 0);
 }
 }
 
 
-static const char* classnamePortalNode = "PortalNode";
-
-template<>
-I64 LuaBinder::getWrappedTypeSignature<PortalNode>()
-{
-	return 8385999185171246748;
-}
-
-template<>
-const char* LuaBinder::getWrappedTypeName<PortalNode>()
-{
-	return classnamePortalNode;
-}
-
-/// Pre-wrap method PortalNode::getSceneNodeBase.
-static inline int pwrapPortalNodegetSceneNodeBase(lua_State* l)
-{
-	LuaUserData* ud;
-	(void)ud;
-	void* voidp;
-	(void)voidp;
-	PtrSize size;
-	(void)size;
-
-	LuaBinder::checkArgsCount(l, 1);
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, classnamePortalNode, 8385999185171246748, ud))
-	{
-		return -1;
-	}
-
-	PortalNode* self = ud->getData<PortalNode>();
-
-	// Call the method
-	SceneNode& ret = *self;
-
-	// Push return value
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "SceneNode");
-	ud->initPointed(-2220074417980276571, const_cast<SceneNode*>(&ret));
-
-	return 1;
-}
-
-/// Wrap method PortalNode::getSceneNodeBase.
-static int wrapPortalNodegetSceneNodeBase(lua_State* l)
-{
-	int res = pwrapPortalNodegetSceneNodeBase(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
-/// Wrap class PortalNode.
-static inline void wrapPortalNode(lua_State* l)
-{
-	LuaBinder::createClass(l, classnamePortalNode);
-	LuaBinder::pushLuaCFuncMethod(l, "getSceneNodeBase", wrapPortalNodegetSceneNodeBase);
-	lua_settop(l, 0);
-}
-
-static const char* classnameSectorNode = "SectorNode";
-
-template<>
-I64 LuaBinder::getWrappedTypeSignature<SectorNode>()
-{
-	return 1288065288496288368;
-}
-
-template<>
-const char* LuaBinder::getWrappedTypeName<SectorNode>()
-{
-	return classnameSectorNode;
-}
-
-/// Pre-wrap method SectorNode::getSceneNodeBase.
-static inline int pwrapSectorNodegetSceneNodeBase(lua_State* l)
-{
-	LuaUserData* ud;
-	(void)ud;
-	void* voidp;
-	(void)voidp;
-	PtrSize size;
-	(void)size;
-
-	LuaBinder::checkArgsCount(l, 1);
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, classnameSectorNode, 1288065288496288368, ud))
-	{
-		return -1;
-	}
-
-	SectorNode* self = ud->getData<SectorNode>();
-
-	// Call the method
-	SceneNode& ret = *self;
-
-	// Push return value
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "SceneNode");
-	ud->initPointed(-2220074417980276571, const_cast<SceneNode*>(&ret));
-
-	return 1;
-}
-
-/// Wrap method SectorNode::getSceneNodeBase.
-static int wrapSectorNodegetSceneNodeBase(lua_State* l)
-{
-	int res = pwrapSectorNodegetSceneNodeBase(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
-/// Wrap class SectorNode.
-static inline void wrapSectorNode(lua_State* l)
-{
-	LuaBinder::createClass(l, classnameSectorNode);
-	LuaBinder::pushLuaCFuncMethod(l, "getSceneNodeBase", wrapSectorNodegetSceneNodeBase);
-	lua_settop(l, 0);
-}
-
 static const char* classnameParticleEmitterNode = "ParticleEmitterNode";
 static const char* classnameParticleEmitterNode = "ParticleEmitterNode";
 
 
 template<>
 template<>
@@ -3279,134 +3145,6 @@ static int wrapSceneGraphnewStaticCollisionNode(lua_State* l)
 	return 0;
 	return 0;
 }
 }
 
 
-/// Pre-wrap method SceneGraph::newPortalNode.
-static inline int pwrapSceneGraphnewPortalNode(lua_State* l)
-{
-	LuaUserData* ud;
-	(void)ud;
-	void* voidp;
-	(void)voidp;
-	PtrSize size;
-	(void)size;
-
-	LuaBinder::checkArgsCount(l, 3);
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, classnameSceneGraph, -7754439619132389154, ud))
-	{
-		return -1;
-	}
-
-	SceneGraph* self = ud->getData<SceneGraph>();
-
-	// Pop arguments
-	const char* arg0;
-	if(LuaBinder::checkString(l, 2, arg0))
-	{
-		return -1;
-	}
-
-	const char* arg1;
-	if(LuaBinder::checkString(l, 3, arg1))
-	{
-		return -1;
-	}
-
-	// Call the method
-	PortalNode* ret = newSceneNode<PortalNode>(self, arg0, arg1);
-
-	// Push return value
-	if(ANKI_UNLIKELY(ret == nullptr))
-	{
-		lua_pushstring(l, "Glue code returned nullptr");
-		return -1;
-	}
-
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "PortalNode");
-	ud->initPointed(8385999185171246748, const_cast<PortalNode*>(ret));
-
-	return 1;
-}
-
-/// Wrap method SceneGraph::newPortalNode.
-static int wrapSceneGraphnewPortalNode(lua_State* l)
-{
-	int res = pwrapSceneGraphnewPortalNode(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
-/// Pre-wrap method SceneGraph::newSectorNode.
-static inline int pwrapSceneGraphnewSectorNode(lua_State* l)
-{
-	LuaUserData* ud;
-	(void)ud;
-	void* voidp;
-	(void)voidp;
-	PtrSize size;
-	(void)size;
-
-	LuaBinder::checkArgsCount(l, 3);
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, classnameSceneGraph, -7754439619132389154, ud))
-	{
-		return -1;
-	}
-
-	SceneGraph* self = ud->getData<SceneGraph>();
-
-	// Pop arguments
-	const char* arg0;
-	if(LuaBinder::checkString(l, 2, arg0))
-	{
-		return -1;
-	}
-
-	const char* arg1;
-	if(LuaBinder::checkString(l, 3, arg1))
-	{
-		return -1;
-	}
-
-	// Call the method
-	SectorNode* ret = newSceneNode<SectorNode>(self, arg0, arg1);
-
-	// Push return value
-	if(ANKI_UNLIKELY(ret == nullptr))
-	{
-		lua_pushstring(l, "Glue code returned nullptr");
-		return -1;
-	}
-
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "SectorNode");
-	ud->initPointed(1288065288496288368, const_cast<SectorNode*>(ret));
-
-	return 1;
-}
-
-/// Wrap method SceneGraph::newSectorNode.
-static int wrapSceneGraphnewSectorNode(lua_State* l)
-{
-	int res = pwrapSceneGraphnewSectorNode(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
 /// Pre-wrap method SceneGraph::newParticleEmitterNode.
 /// Pre-wrap method SceneGraph::newParticleEmitterNode.
 static inline int pwrapSceneGraphnewParticleEmitterNode(lua_State* l)
 static inline int pwrapSceneGraphnewParticleEmitterNode(lua_State* l)
 {
 {
@@ -3852,8 +3590,6 @@ static inline void wrapSceneGraph(lua_State* l)
 	LuaBinder::pushLuaCFuncMethod(l, "newPointLightNode", wrapSceneGraphnewPointLightNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newPointLightNode", wrapSceneGraphnewPointLightNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newSpotLightNode", wrapSceneGraphnewSpotLightNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newSpotLightNode", wrapSceneGraphnewSpotLightNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newStaticCollisionNode", wrapSceneGraphnewStaticCollisionNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newStaticCollisionNode", wrapSceneGraphnewStaticCollisionNode);
-	LuaBinder::pushLuaCFuncMethod(l, "newPortalNode", wrapSceneGraphnewPortalNode);
-	LuaBinder::pushLuaCFuncMethod(l, "newSectorNode", wrapSceneGraphnewSectorNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newParticleEmitterNode", wrapSceneGraphnewParticleEmitterNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newParticleEmitterNode", wrapSceneGraphnewParticleEmitterNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newReflectionProbeNode", wrapSceneGraphnewReflectionProbeNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newReflectionProbeNode", wrapSceneGraphnewReflectionProbeNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newReflectionProxyNode", wrapSceneGraphnewReflectionProxyNode);
 	LuaBinder::pushLuaCFuncMethod(l, "newReflectionProxyNode", wrapSceneGraphnewReflectionProxyNode);
@@ -4251,8 +3987,6 @@ void wrapModuleScene(lua_State* l)
 	wrapPointLightNode(l);
 	wrapPointLightNode(l);
 	wrapSpotLightNode(l);
 	wrapSpotLightNode(l);
 	wrapStaticCollisionNode(l);
 	wrapStaticCollisionNode(l);
-	wrapPortalNode(l);
-	wrapSectorNode(l);
 	wrapParticleEmitterNode(l);
 	wrapParticleEmitterNode(l);
 	wrapReflectionProbeNode(l);
 	wrapReflectionProbeNode(l);
 	wrapReflectionProxyNode(l);
 	wrapReflectionProxyNode(l);

+ 0 - 32
src/anki/script/Scene.xml

@@ -299,22 +299,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 				</method>
 				</method>
 			</methods>
 			</methods>
 		</class>
 		</class>
-		<class name="PortalNode">
-			<methods>
-				<method name="getSceneNodeBase">
-					<overrideCall>SceneNode&amp; ret = *self;</overrideCall>
-					<return>SceneNode&amp;</return>
-				</method>
-			</methods>
-		</class>
-		<class name="SectorNode">
-			<methods>
-				<method name="getSceneNodeBase">
-					<overrideCall>SceneNode&amp; ret = *self;</overrideCall>
-					<return>SceneNode&amp;</return>
-				</method>
-			</methods>
-		</class>
 		<class name="ParticleEmitterNode">
 		<class name="ParticleEmitterNode">
 			<methods>
 			<methods>
 				<method name="getSceneNodeBase">
 				<method name="getSceneNodeBase">
@@ -403,22 +387,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 					</args>
 					</args>
 					<return>StaticCollisionNode*</return>
 					<return>StaticCollisionNode*</return>
 				</method>
 				</method>
-				<method name="newPortalNode">
-					<overrideCall><![CDATA[PortalNode* ret = newSceneNode<PortalNode>(self, arg0, arg1);]]></overrideCall>
-					<args>
-						<arg>const CString&amp;</arg>
-						<arg>const CString&amp;</arg>
-					</args>
-					<return>PortalNode*</return>
-				</method>
-				<method name="newSectorNode">
-					<overrideCall><![CDATA[SectorNode* ret = newSceneNode<SectorNode>(self, arg0, arg1);]]></overrideCall>
-					<args>
-						<arg>const CString&amp;</arg>
-						<arg>const CString&amp;</arg>
-					</args>
-					<return>SectorNode*</return>
-				</method>
 				<method name="newParticleEmitterNode">
 				<method name="newParticleEmitterNode">
 					<overrideCall><![CDATA[ParticleEmitterNode* ret = newSceneNode<ParticleEmitterNode>(self, arg0, arg1);]]></overrideCall>
 					<overrideCall><![CDATA[ParticleEmitterNode* ret = newSceneNode<ParticleEmitterNode>(self, arg0, arg1);]]></overrideCall>
 					<args>
 					<args>

+ 1 - 51
tools/scene/Exporter.cpp

@@ -792,22 +792,6 @@ void Exporter::visitNode(const aiNode* ainode)
 				m_staticCollisionNodes.push_back(n);
 				m_staticCollisionNodes.push_back(n);
 				special = true;
 				special = true;
 			}
 			}
-			else if(prop.first == "portal" && prop.second == "true")
-			{
-				Portal portal;
-				portal.m_meshIndex = meshIndex;
-				portal.m_transform = toAnkiMatrix(ainode->mTransformation);
-				m_portals.push_back(portal);
-				special = true;
-			}
-			else if(prop.first == "sector" && prop.second == "true")
-			{
-				Sector sector;
-				sector.m_meshIndex = meshIndex;
-				sector.m_transform = toAnkiMatrix(ainode->mTransformation);
-				m_sectors.push_back(sector);
-				special = true;
-			}
 			else if(prop.first == "lod1")
 			else if(prop.first == "lod1")
 			{
 			{
 				lod1MeshName = prop.second;
 				lod1MeshName = prop.second;
@@ -998,44 +982,10 @@ void Exporter::exportAll()
 		file << "node = scene:newStaticCollisionNode(\"" << name << "\", \"" << fname << "\", trf)\n";
 		file << "node = scene:newStaticCollisionNode(\"" << name << "\", \"" << fname << "\", trf)\n";
 	}
 	}
 
 
-	//
-	// Export portals
-	//
-	unsigned i = 0;
-	for(const Portal& portal : m_portals)
-	{
-		uint32_t meshIndex = portal.m_meshIndex;
-		exportMesh(*m_scene->mMeshes[meshIndex], nullptr, 3);
-
-		std::string name = getMeshName(getMeshAt(meshIndex));
-		std::string fname = m_rpath + name + ".ankimesh";
-		file << "\nnode = scene:newPortalNode(\"" << name << i << "\", \"" << fname << "\")\n";
-
-		writeNodeTransform("node", portal.m_transform);
-		++i;
-	}
-
-	//
-	// Export sectors
-	//
-	i = 0;
-	for(const Sector& sector : m_sectors)
-	{
-		uint32_t meshIndex = sector.m_meshIndex;
-		exportMesh(*m_scene->mMeshes[meshIndex], nullptr, 3);
-
-		std::string name = getMeshName(getMeshAt(meshIndex));
-		std::string fname = m_rpath + name + ".ankimesh";
-		file << "\nnode = scene:newSectorNode(\"" << name << i << "\", \"" << fname << "\")\n";
-
-		writeNodeTransform("node", sector.m_transform);
-		++i;
-	}
-
 	//
 	//
 	// Export particle emitters
 	// Export particle emitters
 	//
 	//
-	i = 0;
+	int i = 0;
 	for(const ParticleEmitter& p : m_particleEmitters)
 	for(const ParticleEmitter& p : m_particleEmitters)
 	{
 	{
 		std::string name = "particles" + std::to_string(i);
 		std::string name = "particles" + std::to_string(i);

+ 0 - 11
tools/scene/Exporter.h

@@ -47,15 +47,6 @@ struct VertexWeight
 	uint32_t m_bonesCount;
 	uint32_t m_bonesCount;
 };
 };
 
 
-class Portal
-{
-public:
-	uint32_t m_meshIndex;
-	aiMatrix4x4 m_transform;
-};
-
-using Sector = Portal;
-
 class ParticleEmitter
 class ParticleEmitter
 {
 {
 public:
 public:
@@ -126,8 +117,6 @@ public:
 	std::ofstream m_sceneFile;
 	std::ofstream m_sceneFile;
 
 
 	std::vector<StaticCollisionNode> m_staticCollisionNodes;
 	std::vector<StaticCollisionNode> m_staticCollisionNodes;
-	std::vector<Portal> m_portals;
-	std::vector<Sector> m_sectors;
 	std::vector<ParticleEmitter> m_particleEmitters;
 	std::vector<ParticleEmitter> m_particleEmitters;
 	std::vector<ReflectionProbe> m_reflectionProbes;
 	std::vector<ReflectionProbe> m_reflectionProbes;
 	std::vector<ReflectionProxy> m_reflectionProxies;
 	std::vector<ReflectionProxy> m_reflectionProxies;