示例#1
0
LPOBJECT3D clsScene::getFirstObject()
{
	CLASS_ID idFound;
	if ( getFirstObject(&idFound) )
		return objects.at(idFound).at(0);
	return NULL;
}
示例#2
0
bool ossimImageChain::addFirst(ossimConnectableObject* obj)
{
   ossimConnectableObject* rightOfThisObj =
      (ossimConnectableObject*)getFirstObject();

   return insertRight(obj, rightOfThisObj);
}
bool TCompCulling::checkAABB(TCompCulling* culling, TCompAbsAABB* aabb)
{
	TCompCulling * cculling = culling;
	TCompCulling::TCullingBits* culling_bits = nullptr;
	culling_bits = &cculling->bits;

	// To get the index of each aabb
	auto hm_aabbs = getHandleManager<TCompAbsAABB>();
	const TCompAbsAABB* base_aabbs = hm_aabbs->getFirstObject();

	intptr_t idx = aabb - base_aabbs;
	return culling_bits->test(idx);
}
void TCompCulling::update() {
	//PROFILE_FUNCTION("TCompCulling: Update");
	// Get access to the comp_camera in a sibling component
	compBaseEntity = MY_OWNER;
	if (!compBaseEntity) return;
	GET_MY(room, TCompRoom);
	if (room && !room->sameRoomPlayer()) return;

	MAT44 view_proj;
	MY_OWNER.sendMsg(TMsgGetCullingViewProj{ &view_proj });

	// Construir el set de planos usando la view_proj
	planes.fromViewProjection(view_proj);

	// Start from zero
	bits.reset();

	// Traverse all aabb's defined in the game
	// and test them
	auto hm = getHandleManager<TCompAbsAABB>();
	TCompAbsAABB* aabb = hm->getFirstObject();
	PROFILE_FUNCTION("TCompCulling: do culling");
	for (size_t i = 0; i < hm->size(); ++i, ++aabb) {
		PROFILE_FUNCTION("TCompCulling: do culling each");

		CHandle aabb_h = aabb;
		CHandle aabb_h_owner = aabb_h.getOwner();

		bool isPlayer = aabb_h_owner == CPlayerBase::handle_player;
		/*{
			PROFILE_FUNCTION("TCompCulling: isPlayer");
			isPlayer = MY_OWNER == CPlayerBase::handle_player;
		}*/
		{
			PROFILE_FUNCTION("TCompCulling: isVisible");
			if (isPlayer) {
				bits.set(i);
			}
			else if (planes.isVisible(aabb)) {
				bits.set(i);
			}
		}
	}
}