mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-15 15:18:59 +00:00
make screendrops independent of neo.txd; enable new rendering by default
This commit is contained in:
parent
b41f93fcd6
commit
7613528e7e
3 changed files with 38 additions and 25 deletions
|
@ -260,17 +260,14 @@ enum Config {
|
||||||
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
|
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
|
||||||
//#define USE_TEXTURE_POOL
|
//#define USE_TEXTURE_POOL
|
||||||
#ifdef LIBRW
|
#ifdef LIBRW
|
||||||
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||||
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||||
//#define SCREEN_DROPLETS // neo water droplets
|
#define SCREEN_DROPLETS // neo water droplets
|
||||||
//#define NEW_RENDERER // leeds-like world rendering, needs librw
|
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EXTENDED_COLOURFILTER
|
#ifndef EXTENDED_COLOURFILTER
|
||||||
#undef SCREEN_DROPLETS // we need the front- (or back-)buffer for this effect
|
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
|
||||||
#endif
|
|
||||||
#ifndef EXTENDED_PIPELINES
|
|
||||||
#undef SCREEN_DROPLETS // we need neo.txd
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Water & Particle
|
// Water & Particle
|
||||||
|
|
|
@ -76,13 +76,36 @@ ScreenDroplets::Initialise(void)
|
||||||
ms_splashObject = nil;
|
ms_splashObject = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create white circle mask for rain drops
|
||||||
|
static RwTexture*
|
||||||
|
CreateDropMask(int32 size)
|
||||||
|
{
|
||||||
|
RwImage *img = RwImageCreate(size, size, 32);
|
||||||
|
RwImageAllocatePixels(img);
|
||||||
|
|
||||||
|
uint8 *pixels = RwImageGetPixels(img);
|
||||||
|
int32 stride = RwImageGetStride(img);
|
||||||
|
|
||||||
|
for(int y = 0; y < size; y++){
|
||||||
|
float yf = ((y + 0.5f)/size - 0.5f)*2.0f;
|
||||||
|
for(int x = 0; x < size; x++){
|
||||||
|
float xf = ((x + 0.5f)/size - 0.5f)*2.0f;
|
||||||
|
memset(&pixels[y*stride + x*4], xf*xf + yf*yf < 1.0f ? 0xFF : 0x00, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 width, height, depth, format;
|
||||||
|
RwImageFindRasterFormat(img, rwRASTERTYPETEXTURE, &width, &height, &depth, &format);
|
||||||
|
RwRaster *ras = RwRasterCreate(width, height, depth, format);
|
||||||
|
RwRasterSetFromImage(ras, img);
|
||||||
|
RwImageDestroy(img);
|
||||||
|
return RwTextureCreate(ras);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ScreenDroplets::InitDraw(void)
|
ScreenDroplets::InitDraw(void)
|
||||||
{
|
{
|
||||||
if(CustomPipes::neoTxd == nil)
|
ms_maskTex = CreateDropMask(64);
|
||||||
return;
|
|
||||||
|
|
||||||
ms_maskTex = CustomPipes::neoTxd->find("dropmask");
|
|
||||||
|
|
||||||
ms_screenTex = RwTextureCreate(nil);
|
ms_screenTex = RwTextureCreate(nil);
|
||||||
RwTextureSetFilterMode(ms_screenTex, rwFILTERLINEAR);
|
RwTextureSetFilterMode(ms_screenTex, rwFILTERLINEAR);
|
||||||
|
@ -138,10 +161,6 @@ ScreenDroplets::Shutdown(void)
|
||||||
void
|
void
|
||||||
ScreenDroplets::Process(void)
|
ScreenDroplets::Process(void)
|
||||||
{
|
{
|
||||||
// no need to do anything if we can't render
|
|
||||||
if(CustomPipes::neoTxd == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ProcessCameraMovement();
|
ProcessCameraMovement();
|
||||||
SprayDrops();
|
SprayDrops();
|
||||||
ProcessMoving();
|
ProcessMoving();
|
||||||
|
@ -179,9 +198,6 @@ ScreenDroplets::Render(void)
|
||||||
{
|
{
|
||||||
ScreenDrop *drop;
|
ScreenDrop *drop;
|
||||||
|
|
||||||
if(CustomPipes::neoTxd == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DefinedState();
|
DefinedState();
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(ms_maskTex));
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(ms_maskTex));
|
||||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, FALSE);
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, FALSE);
|
||||||
|
|
|
@ -171,8 +171,8 @@ RwFrame *RwCameraGetFrame(const RwCamera *camera) { return camera->getFrame(
|
||||||
|
|
||||||
RwImage *RwImageCreate(RwInt32 width, RwInt32 height, RwInt32 depth) { return Image::create(width, height, depth); }
|
RwImage *RwImageCreate(RwInt32 width, RwInt32 height, RwInt32 depth) { return Image::create(width, height, depth); }
|
||||||
RwBool RwImageDestroy(RwImage * image) { image->destroy(); return true; }
|
RwBool RwImageDestroy(RwImage * image) { image->destroy(); return true; }
|
||||||
RwImage *RwImageAllocatePixels(RwImage * image);
|
RwImage *RwImageAllocatePixels(RwImage * image) { image->allocate(); return image; }
|
||||||
RwImage *RwImageFreePixels(RwImage * image);
|
RwImage *RwImageFreePixels(RwImage * image) { image->free(); return image; }
|
||||||
RwImage *RwImageCopy(RwImage * destImage, const RwImage * sourceImage);
|
RwImage *RwImageCopy(RwImage * destImage, const RwImage * sourceImage);
|
||||||
RwImage *RwImageResize(RwImage * image, RwInt32 width, RwInt32 height);
|
RwImage *RwImageResize(RwImage * image, RwInt32 width, RwInt32 height);
|
||||||
RwImage *RwImageApplyMask(RwImage * image, const RwImage * mask);
|
RwImage *RwImageApplyMask(RwImage * image, const RwImage * mask);
|
||||||
|
@ -187,10 +187,10 @@ RwImage *RwImageSetPixels(RwImage * image, RwUInt8 * pixels) { image->pixels
|
||||||
RwImage *RwImageSetPalette(RwImage * image, RwRGBA * palette) { image->palette = (uint8*)palette; return image; }
|
RwImage *RwImageSetPalette(RwImage * image, RwRGBA * palette) { image->palette = (uint8*)palette; return image; }
|
||||||
RwInt32 RwImageGetWidth(const RwImage * image) { return image->width; }
|
RwInt32 RwImageGetWidth(const RwImage * image) { return image->width; }
|
||||||
RwInt32 RwImageGetHeight(const RwImage * image) { return image->height; }
|
RwInt32 RwImageGetHeight(const RwImage * image) { return image->height; }
|
||||||
RwInt32 RwImageGetDepth(const RwImage * image);
|
RwInt32 RwImageGetDepth(const RwImage * image) { return image->depth; }
|
||||||
RwInt32 RwImageGetStride(const RwImage * image);
|
RwInt32 RwImageGetStride(const RwImage * image) { return image->stride; }
|
||||||
RwUInt8 *RwImageGetPixels(const RwImage * image);
|
RwUInt8 *RwImageGetPixels(const RwImage * image) { return image->pixels; }
|
||||||
RwRGBA *RwImageGetPalette(const RwImage * image);
|
RwRGBA *RwImageGetPalette(const RwImage * image) { return (RwRGBA*)image->palette; }
|
||||||
RwUInt32 RwRGBAToPixel(RwRGBA * rgbIn, RwInt32 rasterFormat);
|
RwUInt32 RwRGBAToPixel(RwRGBA * rgbIn, RwInt32 rasterFormat);
|
||||||
RwRGBA *RwRGBASetFromPixel(RwRGBA * rgbOut, RwUInt32 pixelValue, RwInt32 rasterFormat);
|
RwRGBA *RwRGBASetFromPixel(RwRGBA * rgbOut, RwUInt32 pixelValue, RwInt32 rasterFormat);
|
||||||
RwBool RwImageSetGamma(RwReal gammaValue);
|
RwBool RwImageSetGamma(RwReal gammaValue);
|
||||||
|
|
Loading…
Reference in a new issue