Example #1
0
    //-----------------------------------------------------------------------
	Vector4 Light::getAs4DVector(bool cameraRelativeIfSet) const
	{
		Vector4 ret;
        if (mLightType == Light::LT_DIRECTIONAL)
        {
            ret = -(getDerivedDirection()); // negate direction as 'position'
            ret.w = 0.0; // infinite distance
        }	
		else
        {
            ret = getDerivedPosition(cameraRelativeIfSet);
            ret.w = 1.0;
        }
		return ret;
	}
    /* Update function (currently used for making sure the origin stuff for the
        extra culling frustum is up to date */
    void PCZCamera::update(void)
    {
        // make sure the extra culling frustum origin stuff is up to date
		if (mProjType == PT_PERSPECTIVE)
		//if (!mCustomViewMatrix)
		{
			mExtraCullingFrustum.setUseOriginPlane(true);
			mExtraCullingFrustum.setOrigin(getDerivedPosition());
			mExtraCullingFrustum.setOriginPlane(getDerivedDirection(), getDerivedPosition());
		}
		else
		{
			// In ortho mode, we don't want to cull things behind camera.
			// This helps for back casting which is useful for texture shadow projection on directional light.
			mExtraCullingFrustum.setUseOriginPlane(false);
		}
    }