#include "pch.hpp"
//===========================================================================//
// File:	 3D T&L.cpp														 //
// Project:  GameOS					                                         //
// Contents: Functions for hardware transform and lighting					 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 12/27/99  AG		Created								 					 //
//																			 //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp.						                 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//
#include "3DRasterizer.hpp"
#include "DXRasterizer.hpp"
#include "DirectX.hpp"
#include "Debugger.hpp"



//
//
//
void __stdcall gos_SetTransform( gosTRANSFORMTYPE TransformType, gosMATRIX* MatrixData )
{
	gosASSERT( InsideBeginScene);
	gosASSERT( TransformType>=MATRIX_WORLD && TransformType<=MATRIX_WORLD1 );

	SafeFPU();
	wSetTransform( d3dDevice7, (D3DTRANSFORMSTATETYPE)TransformType, (LPD3DMATRIX)MatrixData );
	GameOSFPU();
}

//
//
//
void __stdcall gos_MultiplyTransform( gosTRANSFORMTYPE TransformType, gosMATRIX* MatrixData )
{
	gosASSERT( InsideBeginScene);
	gosASSERT( TransformType>=MATRIX_WORLD && TransformType<=MATRIX_WORLD1 );

	SafeFPU();
	wMultiplyTransform( d3dDevice7, (D3DTRANSFORMSTATETYPE)TransformType, (LPD3DMATRIX)MatrixData );
	GameOSFPU();
}

//
//
//
void __stdcall gos_SetLight( DWORD LightNumber, gosLIGHT* LightData )
{
	gosASSERT( InsideBeginScene);
	gosASSERT( sizeof(D3DLIGHT7)==sizeof(gosLIGHT) );

	SafeFPU();
	wSetLight( d3dDevice7, LightNumber, (LPD3DLIGHT7)LightData );
	GameOSFPU();
}

//
//
//
void __stdcall gos_LightEnable( DWORD LightNumber, bool Enable )
{
	gosASSERT( InsideBeginScene);

	SafeFPU();
	wLightEnable( d3dDevice7, LightNumber, Enable );
	GameOSFPU();
}

//
//
//
void __stdcall gos_SetMaterial( gosMATERIAL* MaterialData )
{
	gosASSERT( InsideBeginScene);
	gosASSERT( sizeof(D3DMATERIAL7)==sizeof(gosMATERIAL) );

	SafeFPU();
	wSetMaterial( d3dDevice7, (LPD3DMATERIAL7)MaterialData );
	GameOSFPU();
}



