Пример #1
0
void PolyhedronColliderGeometry::UpdateProxy(const RigidBody &body, Proxy &proxy)
{
	if (body.mParent->cphy->mColliderType != 0 || body.mParent->cphy->gameObject->GetFlag("Kinetic"))
		UpdateAABB(body, proxy);
	else
	{
		if (mDoItOnce)
		{
			UpdateAABB(body, proxy);
			mDoItOnce = false;
		}
	}
}
Пример #2
0
PointLight::PointLight(const LightBaseParams& baseParams,const Transform& transform, float radius)
	:Light(baseParams)
	,m_radius(radius)
	,m_transform(transform)
{
	UpdateAABB();
}
Пример #3
0
void BoxShape::UpdatePosition(glm::vec2 change)
{
	m_center.x += change.x;
	m_center.y += change.y;

	UpdateAABB();
}
Пример #4
0
/**
	* function to move the character or ship to a relative position from the current position 
*/
void CCharacter::MoveRelTo (Vector Move)	///Moving relative to the character current Position
{
	///Adding relative movement
	Position += Move; 

	///Updating the bounding box
	UpdateAABB ();
}
Пример #5
0
/**
	* function to move the character or ship to a position based on x, y, z units from the current position
*/
void CCharacter::MoveRelTo	(float x, float y, float z)	///Moves x,y,z units from the to the current position
{
	Position.v[X3D] += x; /// update the position x by increasing x units of the character
	Position.v[Y3D] += y; /// update the position y by increasing y units of the character
	Position.v[Z3D] += z; /// update the position z by increasing z units of the character

	///Updating the bounding box
	UpdateAABB ();
}
Пример #6
0
/**
	* function to move to an absolute position to the character or ship to a position x, y, z
*/
void CCharacter::MoveTo		(float x, float y, float z)	///Moves to the absolute coordinate x,y,z
{
	Position.v[X3D] = x;  //actualizar la posicion del caracter en el plano x
	Position.v[Y3D] = y;  //actualizar la posicion del caracter en el plano y
	Position.v[Z3D] = z;  //actualizar la posicion del caracter en el plano z

	///Updating the bounding box
	UpdateAABB ();
}
Пример #7
0
BoxShape::BoxShape(float x, float y, float w, float h, int angle)
{
	m_center.x = x + w/2;
	m_center.y = y + h/2;
	m_width = w;
	m_height = h;
	m_angle = angle;

	UpdateAABB();
}
Пример #8
0
bool MovingEntity::HorizontalColision(Vector3 pos)
{
	bool colided = false;

	GatherBlockPositions(pos);

	for (int i = 0;i < 36;i++)
	{
		BlockPosition *bp = &_blockPositions[i];

		if (_world->IsBlockCollidable(bp->position.x,bp->position.y,bp->position.z))
		{
			BoundingBox blockBox = BoundingBox(Vector3(bp->position.x,bp->position.y,bp->position.z),Vector3(bp->position.x+1,bp->position.y+1,bp->position.z+1));

			if (_aabb.intersect(blockBox))
			{
				colided = true;

				Vector3 direction = Vector3(_position.x, 0.0f, _position.z);
                direction.x -= pos.x;
                direction.z -= pos.z;

				// Calculate the point of intersection on the block's AABB
				Vector3 blockPoi = blockBox.ClosestPointTo(pos);

				BoundingBox newAABB = BoundingBox(Vector3(pos.x - _downSize.x,pos.y - _downSize.y,pos.z - _downSize.z),Vector3(pos.x + _upSize.x,pos.y + _upSize.y,pos.z +_upSize.z));
				Vector3 entityPoi = newAABB.ClosestPointTo(blockPoi);

				Vector3 planeNormal = blockBox.getFirstHitPlane(direction, pos, _aabb.getDimension(), true, false, true);

				// Find a vector parallel to the surface normal
                Vector3 slideVector = Vector3(planeNormal.z, 0, -planeNormal.x);
                Vector3 pushBack = blockPoi - entityPoi;

                // Calculate the intensity of the diversion alongside the block
                double length =  Vector3::dot(slideVector,direction);

                Vector3 newPosition;
                newPosition.z = pos.z + pushBack.z * 0.2f + length * slideVector.z;
                newPosition.x = pos.x + pushBack.x * 0.2f + length * slideVector.x;
                newPosition.y = _position.y;

				_position = newPosition;

				UpdateAABB();
			}
		}
	}

	return colided;
}
Пример #9
0
void CalculateAABB(const sreBoundingVolumeCylinder& cylinder, sreBoundingVolumeAABB& AABB) {
        AABB.dim_min = AABB.dim_max = cylinder.center;
        for (float factor = - 0.5f; factor < 1.0f; factor += 1.0f) {
            UpdateAABB(AABB, cylinder.center + factor * cylinder.length * cylinder.axis + cylinder.radius *
                Vector3D(-1.0f, 0, 0) * (1.0f - Dot(cylinder.axis, Vector3D(-1.0f, 0, 0))));
            UpdateAABB(AABB, cylinder.center + factor * cylinder.length * cylinder.axis + cylinder.radius *
                Vector3D(1.0f, 0, 0) * (1.0f - Dot(cylinder.axis, Vector3D(1.0f, 0, 0))));
            UpdateAABB(AABB, cylinder.center + factor * cylinder.length * cylinder.axis + cylinder.radius *
                Vector3D(0, -1.0f, 0) * (1.0f - Dot(cylinder.axis, Vector3D(0, -1.0f, 0))));
            UpdateAABB(AABB, cylinder.center + factor * cylinder.length * cylinder.axis + cylinder.radius *
                Vector3D(0, 1.0f, 0) * (1.0f - Dot(cylinder.axis, Vector3D(0, 1.0f, 0))));
            UpdateAABB(AABB, cylinder.center + factor * cylinder.length * cylinder.axis + cylinder.radius *
                Vector3D(0, 0, -1.0f) * (1.0f - Dot(cylinder.axis, Vector3D(0, 0, -1.0f))));
            UpdateAABB(AABB, cylinder.center + factor * cylinder.length * cylinder.axis + cylinder.radius *
                Vector3D(0, 0, 1.0f) * (1.0f - Dot(cylinder.axis, Vector3D(0, 0, 1.0f))));
       }
#if 0
        // Construct two spheres at the endpoints of the cylinder, and use the union of their AABBs.
        // Should be optimized to exclude half of the spheres at the endpoint.
        sreBoundingVolumeSphere endpoint_sphere;
        endpoint_sphere.center = cylinder.center - cylinder.length * cylinder.axis * 0.5;
        endpoint_sphere.radius = cylinder.radius;
        AABB.dim_min = endpoint_sphere.center - Vector3D(endpoint_sphere.radius, endpoint_sphere.radius,
            endpoint_sphere.radius);
        AABB.dim_max = endpoint_sphere.center + Vector3D(endpoint_sphere.radius, endpoint_sphere.radius,
            endpoint_sphere.radius);
        endpoint_sphere.center = cylinder.center - cylinder.length * cylinder.axis * 0.5;
        endpoint_sphere.radius = cylinder.radius;
        sreBoundingVolumeAABB AABB_endpoint2;
        AABB_endpoint2.dim_min = endpoint_sphere.center - Vector3D(endpoint_sphere.radius,
            endpoint_sphere.radius, endpoint_sphere.radius);
        AABB_endpoint2.dim_max = endpoint_sphere.center + Vector3D(endpoint_sphere.radius,
            endpoint_sphere.radius, endpoint_sphere.radius);
        UpdateAABB(AABB, AABB_endpoint2);
#endif
}
Пример #10
0
void cLight::Type( const LIGHT_TYPE& type ) {
	mType = type;
	UpdateAABB();
}
Пример #11
0
void cLight::Radius( const eeFloat& radius ) {
	if ( radius > 0 ) {
		mRadius = radius;
		UpdateAABB();
	}
}
Пример #12
0
void cLight::UpdatePos( const eeFloat& x, const eeFloat& y ) {
	mPos.x = x;
	mPos.y = y;
	UpdateAABB();
}
Пример #13
0
/**   
	* @fn void CShoot::SubtypeChange(CSH_SHOOT_TYPE	ShootType)
	* Any subtype change changes AABB and size
    * @ Param [in] ShootType Type of shoot
*/
void CShoot::SubtypeChange(CSH_SHOOT_TYPE	ShootType)
{
	SubType = ShootType;

	if (CHAR_2D == RenderMode)
	{
		Size.v[XDIM] = 0.05f;
		Size.v[YDIM] = 0.3f;
		Size.v[ZDIM] = 0.0f;
	}
	else switch (SubType)
		{
			case CSH_PLAYER:
				Health = 4;	//Amount of power a player shoot may substract from the enemy
				Size.v[XDIM] = 0.1f; 
				Size.v[YDIM] = 0.25f;
				Size.v[ZDIM] = 0.0f;
				break;
			case CSH_PLAYER3D:
				Health = 20;	//Amount of power a player shoot on 3D mode may substract from the enemy
				Size.v[XDIM] = 0.05f; //5.05	.1
				Size.v[YDIM] = 0.3f;	//.3	.25
				Size.v[ZDIM] = 0.0f;
			break;
			case CSH_PLAYER3D_CHEVRON:
				Health = 50;	//Amount of power a player shoot on 3D mode Chevron may substract from the enemy
				Size.v[XDIM] = 0.5f; //5.05 
				Size.v[YDIM] = 0.3f;  //.3
				Size.v[ZDIM] = 0.0f;
			break;
			case CSH_AUXILIAR_LASER:
				Health = 30;	//Amount of power a auxiliar player laser shoot on 3D mode may substract from the enemy
				Size.v[XDIM] = 0.03f;
				Size.v[YDIM] = 0.8f;
				Size.v[ZDIM] = 0.0f;
				if(Player[CurrentPlayer].ShootType == CSH_PLAYER3D_CHEVRON){
					Health = 50;	//Amount of power a auxiliar player laser shoot on 3D mode may substract from the enemy
					Size.v[XDIM] = 0.1f;
					Size.v[YDIM] = 0.8f;
					Size.v[ZDIM] = 0.0f;
				}
			break;
			case CSH_SHIP:
				Health = 3;	//Amount of power an enemy shoot may substract from the player
				Size.v[XDIM] = .033f;
				Size.v[YDIM] = 0.3f;
				Size.v[ZDIM] = 0.0f;				
			break;
			case CSH_CIRCLE_SHIP:
				Health = 10;	//Amount of power an enemy shoot may substract from the player
				Size.v[XDIM] = .035f;
				Size.v[YDIM] = 0.3f;
				Size.v[ZDIM] = 0.0f;				
			break;
			case CSH_SUPPLY_SHIP:
				Health = 10;	//Amount of power an enemy shoot may substract from the player
				Size.v[XDIM] = .035f;
				Size.v[YDIM] = 0.3f;
				Size.v[ZDIM] = 0.0f;				
			break;
			default:;
		}
#ifdef CHAR_USE_AABB
	UpdateAABB();
#endif
}
Пример #14
0
void PointLight::Update()
{
	m_transform.UpdateMatrices();
	SceneManager::GetInstance().GetCurrentScene()->UpdateAllPointLights();
	UpdateAABB();
}
Пример #15
0
void  MovingEntity::Update(float dt)
{
	if (!_isRunning)
		_activeMovementAcc = _movementAcceleration;
	else if (_canFly)
		_activeMovementAcc = _movementAcceleration * 4.0;
	else
		_activeMovementAcc = _movementAcceleration * _runningFactor;

	_oldPosition = _position;

	//slow down speed each pass
	if (fabsf(_moveVelocity.y) > 0.0f)
	{
		_moveVelocity.y += -1.0f * _moveVelocity.y * _groundFristion * dt;
	}

	if (fabsf(_moveVelocity.x) > 0.0f)
	{
		_moveVelocity.x += -1.0f * _moveVelocity.x * _groundFristion * dt;
	}

	if (fabsf(_moveVelocity.z) > 0.0f)
	{
		_moveVelocity.z += -1.0f * _moveVelocity.z * _groundFristion * dt;
	}

	//friction
	if (fabsf(_moveVelocity.x) > _activeMovementAcc || fabsf(_moveVelocity.z) > _activeMovementAcc || fabsf(_moveVelocity.y) > _activeMovementAcc)
	{
		
		float max = std::max(std::max(fabsf(_moveVelocity.x), fabsf(_moveVelocity.z)), fabsf(_moveVelocity.y));
		float div = max / _activeMovementAcc;

		if (div != 0.0f)
		{
			_moveVelocity.x /= div;
			_moveVelocity.z /= div;
			_moveVelocity.y /= div;
		}		
	}

	if (_moveDirection.magnitudeSq() > 0.0f)
	{
		_moveDirection.normalize();
	}

	_moveVelocity.x += _moveDirection.x * _activeMovementAcc;
	_moveVelocity.y += _moveDirection.y * _activeMovementAcc;
	_moveVelocity.z += _moveDirection.z * _activeMovementAcc;

	if (_earthVelocity > -_maxAcceleration && !_canFly && !_isSwimming)
	{
		_earthVelocity -= _earthAcceleration * dt;
	}

	if (_earthVelocity < -_maxAcceleration && !_canFly && !_isSwimming)
	{
		_earthVelocity = -_maxAcceleration * dt;
	}

	// Pull the player down when swimming
	/*if (!_canFly && _isSwimming)
	{
		_earthVelocity = -MAX_EARTH_ACC_WATER;
	}*/

	_position.y += (_moveVelocity.y + _earthVelocity) * dt;

	if(_checkUpDownCollision())
	{
		float oldEarthVelocity = _earthVelocity;
		_earthVelocity = 0;

		if (oldEarthVelocity <= 0)
		{
			// Jumping is only possible, if the entity is standing on ground
			if (_isJumping)
			{
				//playRandomFootstep();
				_isJumping = false;
				_earthVelocity = _jumpIntensity;
			} 
			else if (!_onGround)
			{ 
				// Entity reaches the ground
				//playRandomFootstep();
				_onGround = true;
			}
		} else
		{
			_onGround = false;
		}
	}
	else
	{
		_onGround = false;
	}

	if (_canFly)
	{
		 _earthVelocity = 0.0f;
	}

	_position.x += _moveVelocity.x * dt;
	_position.z += _moveVelocity.z * dt;

	UpdateAABB();

	if(HorizontalColision(_oldPosition))
	{
		if (_canAutostep && _onGround && !_canFly)
		{
			Vector3 testPos = _position + Vector3(0,-_downSize.y,0);
			Vector3 testPos2 = _position + Vector3(0,-_downSize.y,0);
			Vector3 velocityCopy = Vector3::normalized(_moveVelocity);

			testPos.x = testPos.x < 0 ? testPos.x - 1 : testPos.x;
			testPos.y = testPos.y < 0 ? testPos.y - 1 : testPos.y;
			testPos.z = testPos.z < 0 ? testPos.z - 1 : testPos.z;

			testPos2.x = testPos2.x < 0 ? testPos2.x - 1 : testPos2.x;
			testPos2.y = testPos2.y < 0 ? testPos2.y - 1 : testPos2.y;
			testPos2.z = testPos2.z < 0 ? testPos2.z - 1 : testPos2.z;

			//first test if at normal y there is blocking block
			testPos2.x += velocityCopy.x;			
			testPos2.z += velocityCopy.z;

			//second test if at y+1 is non blocking block
			testPos.x += velocityCopy.x;			
			testPos.z += velocityCopy.z;
			testPos.y += 1.0f;
	
			if (!_world->IsBlockCollidable(testPos.x,testPos.y,testPos.z) && _world->IsBlockCollidable(testPos2.x,testPos2.y,testPos2.z))
			{
				Jump();
			}
		}
	}

	/*_moveVelocity = _moveDirection * 4.0f * dt;

	//first check collision with floor
	_position.y = _position.y + _moveVelocity.y;

	if(_checkUpDownCollision())
	{

	}

	//now check collision with walls
	_position.x = _position.x + _moveVelocity.x;	
	_position.z = _position.z + _moveVelocity.z;
	
	UpdateAABB();
	
	HorizontalColision(_oldPosition);*/

	//reset move direction
	_moveDirection.set(0,0,0);

	_isWalking = false;
}
Пример #16
0
void CalculateAABB(const sreBoundingVolumeSphericalSector& spherical_sector, sreBoundingVolumeAABB& AABB) {
        // The circular edge of the spherical cap, the entire top of the spherical cap, and the
        // spherical sector center/origin (the light position) have to be included when
        //calculating the AABB.
        // Add the center.
        AABB.dim_min = AABB.dim_max = spherical_sector.center;
        // Extend the AABB to include the top of the spherical cap. Since the spherical cap is part
        // of the sphere that the sector is based on, we calculate the angle (dot product) between
        // the axis and the AABB dimension vectors and using that to project the axis onto or into
        // the direction of the dimension vector, limiting the angle to the half angular size of
        // the sector (in which case the projection ends at the circular ring of the cap). 
        UpdateAABB(AABB, spherical_sector.center + spherical_sector.radius * ProjectOntoWithLimit(
            spherical_sector.axis, Vector3D(-1.0f, 0, 0), spherical_sector.cos_half_angular_size));
        UpdateAABB(AABB, spherical_sector.center + spherical_sector.radius * ProjectOntoWithLimit(
            spherical_sector.axis, Vector3D(1.0f, 0, 0), spherical_sector.cos_half_angular_size));
        UpdateAABB(AABB, spherical_sector.center + spherical_sector.radius * ProjectOntoWithLimit(
            spherical_sector.axis, Vector3D(0, -1.0f, 0), spherical_sector.cos_half_angular_size));
        UpdateAABB(AABB, spherical_sector.center + spherical_sector.radius * ProjectOntoWithLimit(
            spherical_sector.axis, Vector3D(0, 1.0f, 0), spherical_sector.cos_half_angular_size));
        UpdateAABB(AABB, spherical_sector.center + spherical_sector.radius * ProjectOntoWithLimit(
            spherical_sector.axis, Vector3D(0, 0, -1.0f), spherical_sector.cos_half_angular_size));
        UpdateAABB(AABB, spherical_sector.center + spherical_sector.radius * ProjectOntoWithLimit(
            spherical_sector.axis, Vector3D(0, 0, 1.0f), spherical_sector.cos_half_angular_size));
#if 0
        // This piece of code is unnecessary, the circular edge should already have been included
        // above when required.
        // Calculate the center and radius of the circular edge of the spherical cap.
        Point3D circle_center = spherical_sector.center + spherical_sector.axis *
            spherical_sector.radius * (1.0f - spherical_sector.cos_half_angular_size);
        float circle_radius = spherical_sector.radius * spherical_sector.sin_half_angular_size;
        // Update the AABB with the circle's minimum and maximum bounds in each dimension.
        UpdateAABB(AABB, circle_center + circle_radius * Vector3D(- 1.0f, 0, 0) *
            (1.0f - Dot(spherical_sector.axis, Vector3D(- 1.0f, 0, 0))));
        UpdateAABB(AABB, circle_center + circle_radius * Vector3D(1.0f, 0, 0) *
            (1.0f - Dot(spherical_sector.axis, Vector3D(1.0f, 0, 0))));
        UpdateAABB(AABB, circle_center + circle_radius * Vector3D(0, - 1.0f, 0) *
            (1.0f - Dot(spherical_sector.axis, Vector3D(0, - 1.0f, 0))));
        UpdateAABB(AABB, circle_center + circle_radius * Vector3D(0, 1.0f, 0) *
            (1.0f - Dot(spherical_sector.axis, Vector3D(0, 1.0f, 0))));
        UpdateAABB(AABB, circle_center + circle_radius * Vector3D(0, 0, - 1.0f) *
            (1.0f - Dot(spherical_sector.axis, Vector3D(0, 0, - 1.0f))));
        UpdateAABB(AABB, circle_center + circle_radius * Vector3D(0, 0, 1.0f) *
            (1.0f - Dot(spherical_sector.axis, Vector3D(0, 0, 1.0f))));
#endif
}
Пример #17
0
/**
	* function to move the character or ship to an absolute position from the current position
*/
void CCharacter::MoveTo		(Vector Move)				///Moving to an absolute position. It does not matter where the character is

{
	Position = Move; /// Update position vector based on the Move[x,y,z]
	UpdateAABB (); ///Updating the bounding box
}
Пример #18
0
void BoxShape::SetPosition(glm::vec2 pos)
{
	m_center = pos;
	UpdateAABB();
}
Пример #19
0
void sreFrustum::Calculate() {
    // Calculate eye-space frustum.
    frustum_eye.hull.vertex[0].Set(nearD / e, (1 / ratio) * nearD / e, - nearD);     // Near-top-right.
    frustum_eye.hull.vertex[1].Set(- nearD / e, (1 / ratio) * nearD / e, - nearD);   // Near-top-left.
    frustum_eye.hull.vertex[2].Set(- nearD / e, - (1 / ratio) * nearD / e, - nearD); // Near-bottom-left.
    frustum_eye.hull.vertex[3].Set(nearD / e, - (1 / ratio) * nearD / e, - nearD);   // Near-bottom-right.
    // farD is an arbitrary distance, we actually have an infinite view frustum.
    frustum_eye.hull.vertex[4].Set(farD / e, (1 / ratio) * farD / e, - farD);        // Far-top-right.
    frustum_eye.hull.vertex[5].Set(- farD / e, (1 / ratio) * farD / e, - farD);      // Far-top-left.
    frustum_eye.hull.vertex[6].Set(- farD / e, - (1 / ratio) * farD / e, - farD);    // Far-bottom-left
    frustum_eye.hull.vertex[7].Set(farD / e, - (1 / ratio) * farD / e, - farD);      // Far-bottom-right.
    Matrix4D inverse_view_matrix = Inverse(sre_internal_view_matrix);
    for (int i = 0; i < 8; i++)
        frustum_world.hull.vertex[i] = (inverse_view_matrix * frustum_eye.hull.vertex[i]).GetPoint3D();
    // Calculate the "centroid". Actually we have an infinite view frustum, but the "centroid" is
    // guaranteed to be in the frustum. Use the sphere bounding volume of the frustum to store the centroid.
    frustum_world.sphere.center.Set(0, 0, 0);
    for (int i = 0; i < 8 ; i++)
        frustum_world.sphere.center += frustum_world.hull.vertex[i];
    frustum_world.sphere.center *= (float)1 / 8;
    // Set the planes in eye space.
    float a = 1 / ratio;
    frustum_eye.plane[0].Set(0, 0, - 1.0, - nearD); // Near plane.
    frustum_eye.plane[1].Set(e / sqrtf(e * e  + 1), 0, - 1 / sqrtf(e * e + 1), 0); // Left plane.
    frustum_eye.plane[2].Set(- e / sqrtf(e * e  + 1), 0, - 1 / sqrtf(e * e + 1), 0); // Right plane.
    frustum_eye.plane[3].Set(0, e / sqrtf(e * e  + a * a), - a / sqrtf(e * e + a * a), 0); // Bottom plane.
    frustum_eye.plane[4].Set(0, - e / sqrtf(e * e  + a * a), - a / sqrtf(e * e + a * a), 0); // Top plane.
    frustum_eye.plane[5].Set(0, 0, 1.0, farD);
    // Convert the planes to world space.
    Matrix4D transpose_view_matrix = Transpose(sre_internal_view_matrix);
    dstMatrixMultiplyVectors1xN(6, transpose_view_matrix, &frustum_eye.plane[0],
        &frustum_world.plane[0]);
//    for (int i = 0; i < 5; i++)
//        printf("plane_world[%d] = (%f, %f, %f, %f)\n", i, plane_world[i].K.x, plane_world[i].K.y, plane_world[i].K.z,
//            plane_world[i].K.w);
    // Adjust the number of planes for intersection checks, if SRE_NU_FRUSTUM_PLANES is equal to 5 we don't use the far plane.
    frustum_world.nu_planes = SRE_NU_FRUSTUM_PLANES;
    frustum_eye.nu_planes = SRE_NU_FRUSTUM_PLANES;
#if SRE_NU_FRUSTUM_PLANES == 6
    // Calculate the bounding sphere if there is a far plane.
    frustum_world.sphere.radius = Magnitude(frustum_world.hull.vertex[4] - frustum_world.sphere.center);
    // When there is a far plane, define a special reduced frustum without a far plane.
    frustum_without_far_plane_world = frustum_world;  // Copy fields.
    frustum_without_far_plane_world.nu_planes = 5;
#endif
#ifndef NO_SHADOW_MAP
    // Set the shadow map region for directional lights.
    if (sre_internal_shadows == SRE_SHADOWS_SHADOW_MAPPING) {
        Point3DPadded vertex[8], vertex2[8];
        sreBoundingVolumeAABB AABB = sre_internal_shadow_map_AABB;
        vertex[0] = Point3DPadded(AABB.dim_min.x, AABB.dim_min.y, AABB.dim_min.z);
        vertex[1] = Point3DPadded(AABB.dim_max.x, AABB.dim_min.y, AABB.dim_min.z);
        vertex[2] = Point3DPadded(AABB.dim_min.x, AABB.dim_max.y, AABB.dim_min.z);
        vertex[3] = Point3DPadded(AABB.dim_max.x, AABB.dim_max.y, AABB.dim_min.z);
        vertex[4] = Point3DPadded(AABB.dim_min.x, AABB.dim_min.y, AABB.dim_max.z);
        vertex[5] = Point3DPadded(AABB.dim_max.x, AABB.dim_min.y, AABB.dim_max.z);
        vertex[6] = Point3DPadded(AABB.dim_min.x, AABB.dim_max.y, AABB.dim_max.z);
        vertex[7] = Point3DPadded(AABB.dim_max.x, AABB.dim_max.y, AABB.dim_max.z);
        dstMatrixMultiplyVectors1xN(8, inverse_view_matrix, vertex, vertex2);
        sreBoundingVolumeAABB empty_AABB;
        empty_AABB.dim_min =
            Point3D(FLT_MAX, FLT_MAX, FLT_MAX);
        empty_AABB.dim_max =
            Point3D(- FLT_MAX, - FLT_MAX, - FLT_MAX);
#ifdef USE_SIMD
        sreBoundingVolumeAABB_SIMD region_AABB;
        region_AABB.Set(empty_AABB);
#else
        sreBoundingVolumeAABB region_AABB = empty_AABB;
#endif
        for (int i = 0; i < 8; i++)
            UpdateAABB(region_AABB, vertex2[i]);
#ifdef USE_SIMD
        region_AABB.Get(shadow_map_region_AABB);
#else
        shadow_map_region_AABB = region_AABB;
#endif
#if 0
        sreMessage(SRE_MESSAGE_LOG, "Shadow map region AABB = (%f, %f, %f) - (%f, %f, %f)\n",
            shadow_map_region_AABB.dim_min.x, shadow_map_region_AABB.dim_min.y, shadow_map_region_AABB.dim_min.z,
            shadow_map_region_AABB.dim_max.x, shadow_map_region_AABB.dim_max.y, shadow_map_region_AABB.dim_max.z);
#endif
    }
#endif
   // Set information indicating when the frustum has changed.
    if (most_recent_frame_changed == sre_internal_current_frame - 1)
        changing_every_frame = true;
    // Before to setting changing_every_frame to false, have to check that
    // the frustum wasn't changed already this frame.
    else if (most_recent_frame_changed != sre_internal_current_frame)
        changing_every_frame = false;
    most_recent_frame_changed = sre_internal_current_frame;
}