summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/config.h9
-rw-r--r--src/extras/screendroplets.cpp38
-rw-r--r--src/fakerw/fake.cpp12
3 files changed, 36 insertions, 23 deletions
diff --git a/src/core/config.h b/src/core/config.h
index e5a97049..d3196f9b 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -249,17 +249,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 EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
+#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
+#define SCREEN_DROPLETS // neo water droplets
#endif
#ifndef EXTENDED_COLOURFILTER
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
#endif
-#ifndef EXTENDED_PIPELINES
-#undef SCREEN_DROPLETS // we need neo.txd
-#endif
// Particle
//#define PC_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 2e04aed2..a3b9258b 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);