Esempio n. 1
0
Vector UTIL_GetMouseAim( C_HL2WarsPlayer *pPlayer, int x, int y )
{
	Vector forward;
	// Remap x and y into -1 to 1 normalized space 
	float xf, yf; 
	xf = ( 2.0f * x / (float)(ScreenWidth()-1) ) - 1.0f; 
	yf = ( 2.0f * y / (float)(ScreenHeight()-1) ) - 1.0f; 

	// Flip y axis 
	yf = -yf; 

	const VMatrix &worldToScreen = engine->WorldToScreenMatrix(); 
	VMatrix screenToWorld; 
	MatrixInverseGeneral( worldToScreen, screenToWorld ); 

	// Create two points at the normalized mouse x, y pos and at the near and far z planes (0 and 1 depth) 
	Vector v1, v2; 
	v1.Init( xf, yf, 0.0f ); 
	v2.Init( xf, yf, 1.0f ); 

	Vector o2; 
	// Transform the two points by the screen to world matrix 
	screenToWorld.V3Mul( v1, pPlayer->Weapon_ShootPosition() ); // ray start origin 
	screenToWorld.V3Mul( v2, o2 ); // ray end origin 
	VectorSubtract( o2, pPlayer->Weapon_ShootPosition(), forward ); 
	forward.NormalizeInPlace(); 
	return forward;
}
Esempio n. 2
0
void CEngineTool::CreatePickingRay( const CViewSetup &viewSetup, int x, int y, Vector& org, Vector& forward )
{
	// Remap x and y into -1 to 1 normalized space
	float xf, yf;
	xf = ( 2.0f * (float)x / (float)viewSetup.width ) - 1.0f;
	yf = ( 2.0f * (float)y / (float)viewSetup.height ) - 1.0f;

	// Flip y axis
	yf = -yf;

	VMatrix worldToScreen;
	GetWorldToScreenMatrixForView( viewSetup, &worldToScreen );
	VMatrix screenToWorld;
	MatrixInverseGeneral( worldToScreen, screenToWorld );

	// Create two points at the normalized mouse x, y pos and at the near and far z planes (0 and 1 depth)
	Vector v1, v2;
	v1.Init( xf, yf, 0.0f );
	v2.Init( xf, yf, 1.0f );
    
	Vector o2;
	// Transform the two points by the screen to world matrix
	screenToWorld.V3Mul( v1, org ); // ray start origin
	screenToWorld.V3Mul( v2, o2 );  // ray end origin
	VectorSubtract( o2, org, forward );
	forward.NormalizeInPlace();
}
void CLogicMirrorMovement::Think()
{
    // Attempt to get the player's handle because it didn't exist at Activate time
    if ( !m_hMirrorTarget.Get() )
    {
        // If we will never find a target, we don't have a use... shutdown
        if ( m_strMirrorTarget == NULL_STRING )
            SetNextThink ( NULL );

        //BUGBUG: If m_strSetMirrorTarget doesn't exist in ent list, we get per-think searches with no results ever...
        SetMirrorTarget ( STRING(m_strMirrorTarget) );
    }

    // Make sure all entities are valid
    if ( m_hMirrorTarget.Get() && m_hMovementTarget.Get() && m_hRemoteTarget.Get() && m_hMirrorRelative.Get() )
    {
        // Get our two portal's world transforms transforms
        VMatrix matPortal1ToWorldInv, matPortal2ToWorld;
        MatrixInverseGeneral( m_hMirrorRelative->EntityToWorldTransform(), matPortal1ToWorldInv );
        matPortal2ToWorld = m_hRemoteTarget->EntityToWorldTransform();

        VMatrix matTransformToRemotePortal = matPortal1ToWorldInv * matPortal2ToWorld;

        // Get our scene camera's current orientation
        Vector ptCameraPosition, vCameraLook, vCameraRight, vCameraUp;
        ptCameraPosition		= m_hMirrorTarget->EyePosition();
        m_hMirrorTarget->GetVectors ( &vCameraLook, &vCameraRight, &vCameraUp );

        // map this position and orientation to the remote portal, mirrored (invert the result)
        Vector ptNewPosition, vNewLook;
        ptNewPosition	= matPortal1ToWorldInv * ptCameraPosition;
        ptNewPosition	= matPortal2ToWorld*( Vector( -ptNewPosition.x, -ptNewPosition.y, ptNewPosition.z ) );

        vNewLook		= matPortal1ToWorldInv.ApplyRotation( vCameraLook );
        vNewLook		= matPortal2ToWorld.ApplyRotation( Vector( -vNewLook.x, -vNewLook.y, vNewLook.z) );

        // Set the point camera to the new location/orientation
        QAngle qNewAngles;
        VectorAngles( vNewLook, qNewAngles );
        m_hMovementTarget->Teleport( &ptNewPosition, &qNewAngles, NULL );
    }

    SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
}
Esempio n. 4
0
bool VMatrix::InverseGeneral(VMatrix &vInverse) const
{
	return MatrixInverseGeneral( *this, vInverse );
}
Esempio n. 5
0
//-----------------------------------------------------------------------------
// Purpose: Upon touching a non-filtered entity, CTriggerPortal teleports them to it's
//			remote portal location.
// Input  : *pOther - 
//-----------------------------------------------------------------------------
void CTriggerPortal::Touch( CBaseEntity *pOther )
{
	// If we are enabled, and allowed to react to the touched entity
	if ( PassesTriggerFilters(pOther) )
	{
		// If we somehow lost our pointer to the remote portal, get a new one
		if ( m_hRemotePortal == NULL )
		{
			Disable();
			return;
		}

		bool bDebug = portal_debug.GetBool();
		if ( bDebug )
		{
			Msg("%s TOUCH: for %s\n", GetDebugName(), pOther->GetDebugName() );
		}

		// Don't touch entities that came through us and haven't left us yet.
		EHANDLE hHandle;
		hHandle = pOther;
		if ( m_hDisabledForEntities.Find(hHandle) != m_hDisabledForEntities.InvalidIndex() )
		{
			Msg("    IGNORED\n", GetDebugName(), pOther->GetDebugName() );
			return;
		}

		Pickup_ForcePlayerToDropThisObject( pOther );

		// de-ground this entity
        pOther->SetGroundEntity( NULL );

		// Build a this --> remote transformation
		VMatrix matMyModelToWorld, matMyInverse;
		matMyModelToWorld = this->EntityToWorldTransform();
		MatrixInverseGeneral ( matMyModelToWorld, matMyInverse );

		// Teleport our object
		VMatrix matRemotePortalTransform = m_hRemotePortal->EntityToWorldTransform();
		Vector ptNewOrigin, vLook, vRight, vUp, vNewLook;
		pOther->GetVectors( &vLook, &vRight, &vUp );

		// Move origin
		ptNewOrigin = matMyInverse * pOther->GetAbsOrigin();
		ptNewOrigin = matRemotePortalTransform * Vector( ptNewOrigin.x, -ptNewOrigin.y, ptNewOrigin.z );

		// Re-aim camera
		vNewLook	= matMyInverse.ApplyRotation( vLook );
		vNewLook	= matRemotePortalTransform.ApplyRotation( Vector( -vNewLook.x, -vNewLook.y, vNewLook.z ) );

		// Reorient the physics
	 	Vector vVelocity, vOldVelocity;
		pOther->GetVelocity( &vOldVelocity );
		vVelocity = matMyInverse.ApplyRotation( vOldVelocity );
		vVelocity = matRemotePortalTransform.ApplyRotation( Vector( -vVelocity.x, -vVelocity.y, vVelocity.z ) );

		QAngle qNewAngles;
		VectorAngles( vNewLook, qNewAngles );
		
		if ( pOther->IsPlayer() )
		{
			((CBasePlayer*)pOther)->SnapEyeAngles(qNewAngles);
		}

		Vector vecOldPos = pOther->WorldSpaceCenter();
		if ( bDebug )
		{
			NDebugOverlay::Box( pOther->GetAbsOrigin(), pOther->WorldAlignMins(), pOther->WorldAlignMaxs(), 255,0,0, 8, 20 );
			NDebugOverlay::Axis( pOther->GetAbsOrigin(), pOther->GetAbsAngles(), 10.0f, true, 50 );
		}

		// place player at the new destination
		CTriggerPortal *pPortal = m_hRemotePortal.Get();
		pPortal->DisableForIncomingEntity( pOther );
		pOther->Teleport( &ptNewOrigin, &qNewAngles, &vVelocity );

		if ( bDebug )
		{
			NDebugOverlay::Box( pOther->GetAbsOrigin(), pOther->WorldAlignMins(), pOther->WorldAlignMaxs(), 0,255,0, 8, 20 );
			NDebugOverlay::Line( vecOldPos, pOther->WorldSpaceCenter(), 0,255,0, true, 20 );
			NDebugOverlay::Axis( pOther->GetAbsOrigin(), pOther->GetAbsAngles(), 10.0f, true, 50 );

			Msg("%s TELEPORTED: %s\n", GetDebugName(), pOther->GetDebugName() );
		}

		// test collision on the new teleport location
		Vector vMin, vMax, vCenter;
		pOther->CollisionProp()->WorldSpaceAABB( &vMin, &vMax );
		vCenter = (vMin + vMax) * 0.5f;
		vMin -= vCenter;
		vMax -= vCenter;

		Vector vStart, vEnd;
		vStart	= ptNewOrigin;
		vEnd	= ptNewOrigin;

		Ray_t ray;
		ray.Init( vStart, vEnd, vMin, vMax );
		trace_t tr;
		pPortal->TestCollision( ray, pOther->PhysicsSolidMaskForEntity(), tr );

		// Teleportation caused us to hit something, deal with it.
		if ( tr.DidHit() )
		{
			
		}

		
	}
}
void CNPC_SecobModportal1::Touch( CBaseEntity *pOther )
{
	BaseClass::Touch( pOther );
	


	// Did the player touch me?
	if ( pOther->IsPlayer() )
	{
	
		const char *PlayerSteamID = engine->GetPlayerNetworkIDString(pOther->edict()); //Finds the current players Steam ID.		
		if( PlayerSteamID == NULL)
		return;
		char Portal2Name[ 512 ];
		Q_strncpy( Portal2Name, "Portal2_" ,sizeof(Portal2Name));
		Q_strncat( Portal2Name, PlayerSteamID,sizeof(Portal2Name), COPY_ALL_CHARACTERS );
		
		// We look for Portal2 for our teleport point because we are Portal1.
		CBaseEntity *pEnt = NULL;
		pEnt = gEntList.FindEntityByName( pEnt, Portal2Name, NULL, pOther, pOther );
		if (!pEnt )
		{
			return;
		}
	
	EmitSound( "PortalPlayer.EnterPortal" );
	
	//PORTAL TRIGGER CODE.
			// Don't touch entities that came through us and haven't left us yet.
		/*EHANDLE hHandle;
		hHandle = pOther;
		if ( m_hDisabledForEntities.Find(hHandle) != m_hDisabledForEntities.InvalidIndex() )
		{
			Msg("    IGNORED\n", GetDebugName(), pOther->GetDebugName() );
			return;
		}
		Pickup_ForcePlayerToDropThisObject( pOther );*/
	
		pOther->SetGroundEntity( NULL );
	
	// Build a this --> remote transformation
		VMatrix matMyModelToWorld, matMyInverse;
		matMyModelToWorld = pOther->EntityToWorldTransform();
		MatrixInverseGeneral ( matMyModelToWorld, matMyInverse );

		// Teleport our object
		VMatrix matRemotePortalTransform = pEnt->EntityToWorldTransform();
		Vector ptNewOrigin, vLook, vRight, vUp, vNewLook;
		pOther->GetVectors( &vLook, &vRight, &vUp );

		// Move origin
		ptNewOrigin = matMyInverse * pOther->GetAbsOrigin();
		ptNewOrigin = matRemotePortalTransform * Vector( ptNewOrigin.x, -ptNewOrigin.y, ptNewOrigin.z );

		// Re-aim camera
		vNewLook	= matMyInverse.ApplyRotation( vLook );
		vNewLook	= matRemotePortalTransform.ApplyRotation( Vector( -vNewLook.x, -vNewLook.y, vNewLook.z ) );

		// Reorient the physics
	 	Vector vVelocity, vOldVelocity;
		pOther->GetVelocity( &vOldVelocity );
		vVelocity = matMyInverse.ApplyRotation( vOldVelocity );
		vVelocity = matRemotePortalTransform.ApplyRotation( Vector( -vVelocity.x, -vVelocity.y, vVelocity.z ) );

				QAngle qNewAngles;
		VectorAngles( vNewLook, qNewAngles );
		
		if ( pOther->IsPlayer() )
		{
			((CBasePlayer*)pOther)->SnapEyeAngles(qNewAngles);
		}

		Vector vecOldPos = pOther->WorldSpaceCenter();


		// place player at the new destination

		pOther->Teleport( &ptNewOrigin, &qNewAngles, &vVelocity );

		// test collision on the new teleport location
		Vector vMin, vMax, vCenter;
		pOther->CollisionProp()->WorldSpaceAABB( &vMin, &vMax );
		vCenter = (vMin + vMax) * 0.5f;
		vMin -= vCenter;
		vMax -= vCenter;

		Vector vStart, vEnd;
		vStart	= ptNewOrigin;
		vEnd	= ptNewOrigin;

		Ray_t ray;
		ray.Init( vStart, vEnd, vMin, vMax );
		trace_t tr;
		this->TestCollision( ray, pOther->PhysicsSolidMaskForEntity(), tr );

		// Teleportation caused us to hit something, deal with it.
		if ( tr.DidHit() )
		{
			
		}
		
		EmitSound( "PortalPlayer.ExitPortal" );
		
		Vector forward, right, up;

		Vector oldorigin = pOther->GetAbsOrigin();

		AngleVectors ( pOther->GetAbsAngles(), &forward, &right, &up);
		
		// Try to move into the world
		if ( !FindPassableSpace( pOther, forward, 1, oldorigin ) )
		{
			if ( !FindPassableSpace( pOther, right, 1, oldorigin ) )
			{
				if ( !FindPassableSpace( pOther, right, -1, oldorigin ) )		// left
				{
					if ( !FindPassableSpace( pOther, up, 1, oldorigin ) )	// up
					{
						if ( !FindPassableSpace( pOther, up, -1, oldorigin ) )	// down
						{
							if ( !FindPassableSpace( pOther, forward, -1, oldorigin ) )	// back
							{
								pOther->TakeDamage( CTakeDamageInfo( this, this, 1000, DMG_DISSOLVE ) );
							}
						}
					}
				}
			}
		}
	pOther->SetAbsOrigin( oldorigin );
	}
}
Esempio n. 7
0
//-----------------------------------------------------------------------------
// Given a projection matrix, take the extremes of the space in transformed into world space and
// get a bounding sphere.
//-----------------------------------------------------------------------------
void CalculateSphereFromProjectionMatrix( const VMatrix &worldToVolume, Vector *pCenter, float *pflRadius )
{
	VMatrix volumeToWorld;
	MatrixInverseGeneral( worldToVolume, volumeToWorld );
	CalculateSphereFromProjectionMatrixInverse( volumeToWorld, pCenter, pflRadius );
}
Esempio n. 8
0
void CalculateAABBFromProjectionMatrix( const VMatrix &worldToVolume, Vector *pMins, Vector *pMaxs )
{
	VMatrix volumeToWorld;
	MatrixInverseGeneral( worldToVolume, volumeToWorld );
	CalculateAABBFromProjectionMatrixInverse( volumeToWorld, pMins, pMaxs );
}
static int vmatrix_MatrixInverseGeneral (lua_State *L) {
  MatrixInverseGeneral(luaL_checkvmatrix(L, 1), luaL_checkvmatrix(L, 2));
  return 0;
}
void UpdateConstantByIdentifier( CBaseVSShader *pShader, IShaderDynamicAPI* pShaderAPI, IMaterialVar **params, SimpleEnvConstant *pConst, CProceduralContext *pContext,
							bool bPS, int iFirstMutable, int iFirstStatic )
{
	float data[4][4] = { 0, 0, 0, 0,
						0, 0, 0, 0,
						0, 0, 0, 0,
						0, 0, 0, 0 };
	int _register = RemapEnvironmentConstant( bPS, pConst->iHLSLRegister );

	switch ( pConst->iEnvC_ID )
	{
	default:
		Assert(0);
	case HLSLENV_TIME:
		data[0][ 0 ] = pShaderAPI->CurrentTime();
		break;
	case HLSLENV_VIEW_ORIGIN:
	case HLSLENV_VIEW_FWD:
	case HLSLENV_VIEW_RIGHT:
	case HLSLENV_VIEW_UP:
	case HLSLENV_VIEW_WORLDDEPTH:
		Q_memcpy( data, gProcShaderCTRL->AccessEnvConstant( pConst->iEnvC_ID ), sizeof(float)*4 );
		break;
	case HLSLENV_PIXEL_SIZE:
		{
			int bx, by;
			pShaderAPI->GetBackBufferDimensions( bx, by );
			float scale = max( 1.0f, pConst->flSmartDefaultValues[0] );
			data[0][ 0 ] = ( 1.0f / bx ) * scale;
			data[0][ 1 ] = ( 1.0f / by ) * scale;
		}
		break;
	case HLSLENV_FOG_PARAMS:
		Assert( bPS );
		pShaderAPI->SetPixelShaderFogParams( _register );
		return;
	case HLSLENV_STUDIO_LIGHTING_VS:
		//if ( pShader->UsingFlashlight( params ) )
		//	return;
#ifndef SHADER_EDITOR_DLL_SWARM
		pShaderAPI->SetVertexShaderStateAmbientLightCube();
#else
		pShader->PI_SetVertexShaderAmbientLightCube();
		pShader->PI_SetVertexShaderLocalLighting();
#endif
		return;
	case HLSLENV_STUDIO_LIGHTING_PS:
		if ( pShader->UsingFlashlight( params ) )
			return;
#ifndef SHADER_EDITOR_DLL_SWARM
		pShaderAPI->SetPixelShaderStateAmbientLightCube( SSEREG_AMBIENT_CUBE );
		pShaderAPI->CommitPixelShaderLighting( SSEREG_LIGHT_INFO_ARRAY );
#else
		pShader->PI_SetPixelShaderAmbientLightCube( SSEREG_AMBIENT_CUBE );
		pShader->PI_SetPixelShaderLocalLighting( SSEREG_LIGHT_INFO_ARRAY );
#endif
		return;
#ifndef SHADER_EDITOR_DLL_2006
	case HLSLENV_STUDIO_MORPHING:
		{
			pShader->SetHWMorphVertexShaderState_NoTex( VERTEX_SHADER_SHADER_SPECIFIC_CONST_10, VERTEX_SHADER_SHADER_SPECIFIC_CONST_11 );
			bool bUnusedTexCoords[3] = { false, false, !pShaderAPI->IsHWMorphingEnabled() };
			pShaderAPI->MarkUnusedVertexFields( 0, 3, bUnusedTexCoords );
		}
		return;
#endif
	case HLSLENV_FLASHLIGHT_VPMATRIX:
		{
			VMatrix worldToTexture;
			pShaderAPI->GetFlashlightState( worldToTexture );
			Q_memcpy( data, worldToTexture.Base(), sizeof(float)*16 );
			if ( bPS )
				_register = SSEREG_FLASHLIGHT_TO_WORLD_TEXTURE;
		}
		break;
	case HLSLENV_FLASHLIGHT_DATA:
		{
			if ( !pShader->UsingFlashlight( params ) )
				return;
			Assert( bPS );
			VMatrix dummy;
			const FlashlightState_t &flashlightState = pShaderAPI->GetFlashlightState( dummy );
#ifndef SHADER_EDITOR_DLL_2006
			float tweaks[4];
			tweaks[0] = flashlightState.m_flShadowFilterSize / flashlightState.m_flShadowMapResolution;
			tweaks[1] = ShadowAttenFromState( flashlightState );
			pShader->HashShadow2DJitter( flashlightState.m_flShadowJitterSeed, &tweaks[2], &tweaks[3] );
			pShaderAPI->SetPixelShaderConstant( SSEREG_LIGHT_INFO_ARRAY+1, tweaks, 1 ); // c07
#endif

			float vScreenScale[4] = {1280.0f / 32.0f, 768.0f / 32.0f, 0, 0};
			int nWidth, nHeight;
			pShaderAPI->GetBackBufferDimensions( nWidth, nHeight );
			vScreenScale[0] = (float) nWidth  / 32.0f;
			vScreenScale[1] = (float) nHeight / 32.0f;
			pShaderAPI->SetPixelShaderConstant( SSEREG_LIGHT_INFO_ARRAY + 5, vScreenScale, 1 ); // c11

#ifdef SHADER_EDITOR_DLL_2006
			SetFlashLightColorFromState( flashlightState, pShaderAPI, SSEREG_LIGHT_INFO_ARRAY + 4 ); // c10
#else
			SetFlashLightColorFromState( flashlightState, pShaderAPI, SSEREG_LIGHT_INFO_ARRAY + 4, false ); // c10
#endif

			float atten_pos[8];
			atten_pos[0] = flashlightState.m_fConstantAtten;			// c08
			atten_pos[1] = flashlightState.m_fLinearAtten;
			atten_pos[2] = flashlightState.m_fQuadraticAtten;
			atten_pos[3] = flashlightState.m_FarZ;
			atten_pos[4] = flashlightState.m_vecLightOrigin[0];			// c09
			atten_pos[5] = flashlightState.m_vecLightOrigin[1];
			atten_pos[6] = flashlightState.m_vecLightOrigin[2];
			atten_pos[7] = 1.0f;
			pShaderAPI->SetPixelShaderConstant( SSEREG_LIGHT_INFO_ARRAY+2, atten_pos, 2 );
			// PSREG_LIGHT_INFO_ARRAY + 3 !!
		}
		return;
	case HLSLENV_SMART_CALLBACK:
		{
			int index = pConst->iFastLookup;
			if ( index < 0 )
				return;
			Assert( pConst->szSmartHelper );
			pFnClCallback( func ) = gProcShaderCTRL->GetCallback( index )->func;
			func( &data[0][0] );
		}
		break;
	case HLSLENV_SMART_VMT_MUTABLE:
		{
			if ( iFirstMutable < 0 )
				break;
			Assert( pConst->iFastLookup >= 0 && pConst->iFastLookup < AMT_VMT_MUTABLE );
			params[ iFirstMutable + pConst->iFastLookup ]->GetVecValue( &data[0][0], 4 );
		}
		break;
	case HLSLENV_SMART_VMT_STATIC:
		{
			if ( iFirstStatic < 0 )
				break;
			Assert( pConst->iFastLookup >= 0 && pConst->iFastLookup < AMT_VMT_STATIC );
			params[ iFirstStatic + pConst->iFastLookup ]->GetVecValue( &data[0][0], 4 );
		}
		break;
	case HLSLENV_SMART_RANDOM_FLOAT:
		{
			Assert( pConst->iSmartNumComps >= 0 && pConst->iSmartNumComps <= 3 );
			for ( int i = 0; i <= pConst->iSmartNumComps; i++ )
				data[0][i] = RandomFloat( pConst->flSmartDefaultValues[0], pConst->flSmartDefaultValues[1] );
		}
		break;
	case HLSLENV_CUSTOM_MATRIX:
		{
			VMatrix matTmp, matTmpTranspose;
			switch ( pConst->iSmartNumComps )
			{
			case CMATRIX_VIEW:
				pShaderAPI->GetMatrix( MATERIAL_VIEW, matTmp.Base() );
				break;
			case CMATRIX_PROJ:
				pShaderAPI->GetMatrix( MATERIAL_PROJECTION, matTmp.Base() );
				break;
			case CMATRIX_VIEWPROJ:
				{
					VMatrix matV, matP;
					pShaderAPI->GetMatrix( MATERIAL_VIEW, matV.Base() );
					pShaderAPI->GetMatrix( MATERIAL_PROJECTION, matP.Base() );
					MatrixMultiply( matV, matP, matTmp );
				}
				break;
			case CMATRIX_VIEW_INV:
				{
					VMatrix matPre;
					pShaderAPI->GetMatrix( MATERIAL_VIEW, matPre.Base() );
					MatrixInverseGeneral( matPre, matTmp );
				}
				break;
			case CMATRIX_PROJ_INV:
				{
					VMatrix matPre;
					pShaderAPI->GetMatrix( MATERIAL_PROJECTION, matPre.Base() );
					MatrixInverseGeneral( matPre, matTmp );
				}
				break;
			case CMATRIX_VIEWPROJ_INV:
				{
					VMatrix matV, matP, matPre;
					pShaderAPI->GetMatrix( MATERIAL_VIEW, matV.Base() );
					pShaderAPI->GetMatrix( MATERIAL_PROJECTION, matP.Base() );
					MatrixMultiply( matV, matP, matPre );
					MatrixInverseGeneral( matPre, matTmp );
				}
				break;
			}
			MatrixTranspose( matTmp, matTmpTranspose );
			Q_memcpy( &data[0][0], matTmpTranspose.Base(), sizeof(float) * 16 );
		}
		break;
	case HLSLENV_LIGHTMAP_RGB:
#ifdef SHADER_EDITOR_DLL_SWARM
		if ( pContext )
			data[0][0] = pContext->flLightmapScaleFactor;
		else
			data[0][0] = 1.0f;
#elif SHADER_EDITOR_DLL_2006
#else
			data[0][0] = pShaderAPI->GetLightMapScaleFactor();
#endif
		break;
	}

	Assert( pConst->iConstSize >= 1 && pConst->iConstSize <= 4 );
	Assert( _register >= 0 );

	if ( bPS )
		pShaderAPI->SetPixelShaderConstant( _register, &data[0][0], pConst->iConstSize );
	else
		pShaderAPI->SetVertexShaderConstant( _register, &data[0][0], pConst->iConstSize );
}