|
|
//----------------------------------------------------------------------------- // // This file contains color generation functions. // // Copyright (C) Microsoft Corporation, 1997. // // WARNING WARNING WARNING // This cpp file generated from mcp file. // EDIT THE MCP FILE. // I warned you. // WARNING WARNING WARNING // //-----------------------------------------------------------------------------
include(`m4hdr.mh')dnl #include "rgb_pch.h" #pragma hdrstop #include "ccrgn_mh.h"
define(`d_ColorGen', ` void C_ColorGen_$1_$2_$3_$4(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP, PD3DI_RASTSPAN pS) { ifelse(`$1', `Gouraud', ` pS->uB += pP->iDBDX; pS->uG += pP->iDGDX; pS->uR += pP->iDRDX; pS->uA += pP->iDADX;')
ifelse(`$2', `Specular', ` // ATTENTION if we really care, one could argue that saturation after fog is better pCtx->SI.uBB = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBB + (UINT32)pS->uBS, 0xffff); pCtx->SI.uBG = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBG + (UINT32)pS->uGS, 0xffff); pCtx->SI.uBR = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBR + (UINT32)pS->uRS, 0xffff); pS->uBS += pP->iDBSDX; pS->uGS += pP->iDGSDX; pS->uRS += pP->iDRSDX;')
ifelse(`$3', `VertexFog', ` UINT16 uFog = pS->uFog >> 8; // 0.8 pCtx->SI.uBB = (pCtx->SI.uBB>>8)*uFog; // 8.0 * 0.8 = 8.8 pCtx->SI.uBG = (pCtx->SI.uBG>>8)*uFog; pCtx->SI.uBR = (pCtx->SI.uBR>>8)*uFog;
// this is unsigned saturating add in MMX pCtx->SI.uBB = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBB + pCtx->SI.uFogB, 0xffff); pCtx->SI.uBG = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBG + pCtx->SI.uFogG, 0xffff); pCtx->SI.uBR = (UINT16)min< UINT32>((UINT32)pCtx->SI.uBR + pCtx->SI.uFogR, 0xffff);
pS->uFog += (INT16)pS->iDFog;
pCtx->SI.uFogB += pCtx->SI.iFogBDX; pCtx->SI.uFogG += pCtx->SI.iFogGDX; pCtx->SI.uFogR += pCtx->SI.iFogRDX;')
pCtx->pfnColorGenEnd(pCtx, pP, pS);
}')dnl dnl
d_RepStr(`d_RepStr(`d_RepStr(`d_ColorGen(AA, BB, CC, NoMonochrome)', `AA', `Flat', `Gouraud')', `BB', `NoSpecular', `Specular')', `CC', `NoFog', `VertexFog')
void C_ColorGen_All_Monochrome(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP, PD3DI_RASTSPAN pS) { // ATTENTION, need to implement this // D3D_WARN(0,"ColorGen_All_Monochrome unimplemented"); // DDASSERT(0); }
|