From 9c5fabf615313a9bf2afbf0a86c106a0bc631c9c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 19 Jun 2013 04:03:32 +0200 Subject: [PATCH] Add test for ps.1.1 pixel program in snowballs (it works too now) --- code/nel/include/nel/3d/material.h | 8 +++++++- code/snowballs2/client/src/commands.cpp | 13 +++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/3d/material.h b/code/nel/include/nel/3d/material.h index a7ca18bff..b9f063af1 100644 --- a/code/nel/include/nel/3d/material.h +++ b/code/nel/include/nel/3d/material.h @@ -171,7 +171,12 @@ public: * - Alpha of texture in stage 0 is blended with alpha of texture in stage 1. Blend done with the alpha color of each * stage and the whole is multiplied by the alpha in color vertex [AT0*ADiffuseCol+AT1*(1-ADiffuseCol)]*AStage * - RGB still unchanged - * + * Water : + * - Water + * PostProcessing : + * - For internal use only when a pixel program is set manually through activePixelProgram. + * - Only textures are set by CMaterial (probably does not work yet), the rest must be set manually. + * - May be replaced in the future by some generic shader system. */ enum TShader { Normal=0, Bump, @@ -183,6 +188,7 @@ public: PerPixelLightingNoSpec, Cloud, Water, + PostProcessing, shaderCount}; /// \name Texture Env Modes. diff --git a/code/snowballs2/client/src/commands.cpp b/code/snowballs2/client/src/commands.cpp index f5acf0b80..fe33e566a 100644 --- a/code/snowballs2/client/src/commands.cpp +++ b/code/snowballs2/client/src/commands.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #endif // @@ -292,12 +293,17 @@ void initCommands() CommandsMaterial.setBlend(true); #if SBCLIENT_DEV_PIXEL_PROGRAM - static const char *program = + CommandsMaterial.getObjectPtr()->setShader(NL3D::CMaterial::PostProcessing); + static const char *program_arbfp10 = "!!ARBfp1.0\n" "PARAM red = {1.0, 0.0, 0.0, 1.0};\n" "MOV result.color, red;\n" "END\n"; - a_DevPixelProgram = new CPixelProgram(program); + static const char *program_ps10 = + "ps.1.1\n" + "def c0, 1.0, 0.0, 0.0, 1.0\n" + "mov r0, c0\n"; + a_DevPixelProgram = new CPixelProgram(program_ps10); #endif } @@ -326,11 +332,14 @@ void updateCommands() #if SBCLIENT_DEV_PIXEL_PROGRAM NL3D::IDriver *d = dynamic_cast(Driver)->getDriver(); d->activePixelProgram(a_DevPixelProgram); + bool fogEnabled = d->fogEnabled(); + d->enableFog(false); #endif Driver->drawQuad(CQuad(CVector(x0, y0, 0), CVector(x1, y0, 0), CVector(x1, y1, 0), CVector(x0, y1, 0)), CommandsMaterial); #if SBCLIENT_DEV_PIXEL_PROGRAM + d->enableFog(fogEnabled); d->activePixelProgram(NULL); #endif