示例#1
0
文件: envmap.cpp 项目: aap/skygfx
void
RenderReflectionMap_leeds(void)
{
	RwCamera *cam = Scene.camera;
	RwCameraEndUpdate(cam);

	MakeEnvmapRasters();

	RwCameraSetViewWindow(reflectionCam, &cam->viewWindow);

	RwFrameTransform(RwCameraGetFrame(reflectionCam), &RwCameraGetFrame(cam)->ltm, rwCOMBINEREPLACE);

	RwRGBA color = { skyTopRed, skyTopGreen, skyTopBlue, 255 };
//	RwRGBA color = { skyBotRed, skyBotGreen, skyBotBlue, 255 };

	// blend a bit of white into the sky color, otherwise it tends to be very blue
//	color.red = color.red*0.6f + 255*0.4f;
//	color.green = color.green*0.6f + 255*0.4f;
//	color.blue = color.blue*0.6f + 255*0.4f;
	RwCameraClear(reflectionCam, &color, rwCAMERACLEARIMAGE | rwCAMERACLEARZ);

	RwCameraBeginUpdate(reflectionCam);
	RwCamera *savedcam = Scene.camera;
	Scene.camera = reflectionCam;	// they do some begin/end updates with this in the called functions :/
	CClouds__RenderSkyPolys();
	RenderReflectionScene();
	DrawEnvMapCoronas(RwFrameGetLTM(RwCameraGetFrame(reflectionCam))->at);
	Scene.camera = savedcam;
	RwCameraEndUpdate(reflectionCam);

	RwCameraBeginUpdate(cam);
}
static void D3D9GetTransScaleVector(CustomEnvMapPipeMaterialData* data, RpAtomic* atomic, RwV2d* transScale)
{
    RpClump* clump = atomic->clump;
    RwFrame* frame = (RwFrame*)(clump ? clump->object.parent : atomic->object.object.parent);
    const RwV3d& pos = RwFrameGetLTM(frame)->pos;
    float transScaleX = FixedPointToFloat<8>(data->transScaleX) * 50.0f;
    float transScaleY = FixedPointToFloat<8>(data->transScaleY) * 50.0f;

    transScale->x = -((pos.x - static_cast<RwInt32>(pos.x / transScaleX) * transScaleX) * 1.0f / transScaleX);
    transScale->y = -((pos.y - static_cast<RwInt32>(pos.y / transScaleY) * transScaleY) * 1.0f / transScaleY);
}