diff options
author | aap <aap@papnet.eu> | 2020-12-26 14:48:55 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-12-26 14:48:55 +0100 |
commit | 7613528e7e05a4f8b2a0210ddc90fd9023a2f065 (patch) | |
tree | df4c81cd7683a3454ea6164843ef77237272031b /src | |
parent | garage cam fix (diff) | |
download | re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.tar re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.tar.gz re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.tar.bz2 re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.tar.lz re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.tar.xz re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.tar.zst re3-7613528e7e05a4f8b2a0210ddc90fd9023a2f065.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/config.h | 13 | ||||
-rw-r--r-- | src/extras/screendroplets.cpp | 38 | ||||
-rw-r--r-- | src/fakerw/fake.cpp | 12 |
3 files changed, 38 insertions, 25 deletions
diff --git a/src/core/config.h b/src/core/config.h index ae2189e2..f6336be8 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -260,17 +260,14 @@ enum Config { #define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync //#define USE_TEXTURE_POOL #ifdef LIBRW -//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) -//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo) -//#define SCREEN_DROPLETS // neo water droplets -//#define NEW_RENDERER // leeds-like world rendering, needs librw +#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) +#define EXTENDED_PIPELINES // custom render pipelines (includes Neo) +#define SCREEN_DROPLETS // neo water droplets +#define NEW_RENDERER // leeds-like world rendering, needs librw #endif #ifndef EXTENDED_COLOURFILTER -#undef SCREEN_DROPLETS // we need the front- (or back-)buffer for this effect -#endif -#ifndef EXTENDED_PIPELINES -#undef SCREEN_DROPLETS // we need neo.txd +#undef SCREEN_DROPLETS // we need the backbuffer for this effect #endif // Water & Particle diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp index 54866bea..59c597f7 100644 --- a/src/extras/screendroplets.cpp +++ b/src/extras/screendroplets.cpp @@ -76,13 +76,36 @@ ScreenDroplets::Initialise(void) 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 ScreenDroplets::InitDraw(void) { - if(CustomPipes::neoTxd == nil) - return; - - ms_maskTex = CustomPipes::neoTxd->find("dropmask"); + ms_maskTex = CreateDropMask(64); ms_screenTex = RwTextureCreate(nil); RwTextureSetFilterMode(ms_screenTex, rwFILTERLINEAR); @@ -138,10 +161,6 @@ ScreenDroplets::Shutdown(void) void ScreenDroplets::Process(void) { - // no need to do anything if we can't render - if(CustomPipes::neoTxd == nil) - return; - ProcessCameraMovement(); SprayDrops(); ProcessMoving(); @@ -179,9 +198,6 @@ ScreenDroplets::Render(void) { ScreenDrop *drop; - if(CustomPipes::neoTxd == nil) - return; - DefinedState(); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(ms_maskTex)); RwRenderStateSet(rwRENDERSTATEFOGENABLE, FALSE); diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index a35a4ecb..37567927 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -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); } RwBool RwImageDestroy(RwImage * image) { image->destroy(); return true; } -RwImage *RwImageAllocatePixels(RwImage * image); -RwImage *RwImageFreePixels(RwImage * image); +RwImage *RwImageAllocatePixels(RwImage * image) { image->allocate(); return image; } +RwImage *RwImageFreePixels(RwImage * image) { image->free(); return image; } RwImage *RwImageCopy(RwImage * destImage, const RwImage * sourceImage); RwImage *RwImageResize(RwImage * image, RwInt32 width, RwInt32 height); 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; } RwInt32 RwImageGetWidth(const RwImage * image) { return image->width; } RwInt32 RwImageGetHeight(const RwImage * image) { return image->height; } -RwInt32 RwImageGetDepth(const RwImage * image); -RwInt32 RwImageGetStride(const RwImage * image); -RwUInt8 *RwImageGetPixels(const RwImage * image); -RwRGBA *RwImageGetPalette(const RwImage * image); +RwInt32 RwImageGetDepth(const RwImage * image) { return image->depth; } +RwInt32 RwImageGetStride(const RwImage * image) { return image->stride; } +RwUInt8 *RwImageGetPixels(const RwImage * image) { return image->pixels; } +RwRGBA *RwImageGetPalette(const RwImage * image) { return (RwRGBA*)image->palette; } RwUInt32 RwRGBAToPixel(RwRGBA * rgbIn, RwInt32 rasterFormat); RwRGBA *RwRGBASetFromPixel(RwRGBA * rgbOut, RwUInt32 pixelValue, RwInt32 rasterFormat); RwBool RwImageSetGamma(RwReal gammaValue); |