mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-11 23:54:09 +02:00
#15 PSV add livearea resources, fix shadows, fix clip planes, fix inventory lighting, shader optimizations
This commit is contained in:
@@ -223,6 +223,9 @@ struct ShaderCache {
|
|||||||
void bind(Core::Pass pass, Shader::Type type, int fx) {
|
void bind(Core::Pass pass, Shader::Type type, int fx) {
|
||||||
Core::pass = pass;
|
Core::pass = pass;
|
||||||
|
|
||||||
|
if (Core::support.clipDist)
|
||||||
|
fx &= ~ShaderCache::FX_CLIP_PLANE;
|
||||||
|
|
||||||
Shader *shader = getShader(pass, type, fx);
|
Shader *shader = getShader(pass, type, fx);
|
||||||
if (shader)
|
if (shader)
|
||||||
shader->setup();
|
shader->setup();
|
||||||
|
@@ -102,8 +102,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
// muse be equal with base shader
|
// muse be equal with base shader
|
||||||
#define SHADOW_TEX_WIDTH 1024
|
#define SHADOW_TEX_SIZE 1024
|
||||||
#define SHADOW_TEX_HEIGHT 1024
|
|
||||||
|
|
||||||
extern void* osMutexInit ();
|
extern void* osMutexInit ();
|
||||||
extern void osMutexFree (void *obj);
|
extern void osMutexFree (void *obj);
|
||||||
@@ -588,7 +587,7 @@ namespace Core {
|
|||||||
int tFrame;
|
int tFrame;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Stats() : frame(0), fps(0), fpsTime(0), frameIndex(0) {}
|
Stats() : frame(0), fps(0), frameIndex(0), fpsTime(0) {}
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
dips = tris = rt = cb = 0;
|
dips = tris = rt = cb = 0;
|
||||||
|
@@ -396,6 +396,8 @@ namespace GAPI {
|
|||||||
|
|
||||||
int colorMask, blendMode;
|
int colorMask, blendMode;
|
||||||
|
|
||||||
|
bool rebind;
|
||||||
|
|
||||||
void init(Pass pass, int type, int *def, int defCount) {
|
void init(Pass pass, int type, int *def, int defCount) {
|
||||||
const uint8 *vpSrc, *fpSrc;
|
const uint8 *vpSrc, *fpSrc;
|
||||||
switch (pass) {
|
switch (pass) {
|
||||||
@@ -606,8 +608,10 @@ namespace GAPI {
|
|||||||
{ 32, SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ARGB , SCE_GXM_COLOR_FORMAT_A8R8G8B8 }, // RGBA
|
{ 32, SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ARGB , SCE_GXM_COLOR_FORMAT_A8R8G8B8 }, // RGBA
|
||||||
{ 16, SCE_GXM_TEXTURE_FORMAT_U5U6U5_RGB , SCE_GXM_COLOR_FORMAT_U5U6U5_RGB }, // RGB16
|
{ 16, SCE_GXM_TEXTURE_FORMAT_U5U6U5_RGB , SCE_GXM_COLOR_FORMAT_U5U6U5_RGB }, // RGB16
|
||||||
{ 16, SCE_GXM_TEXTURE_FORMAT_U1U5U5U5_ARGB , SCE_GXM_COLOR_FORMAT_U1U5U5U5_ARGB }, // RGBA16
|
{ 16, SCE_GXM_TEXTURE_FORMAT_U1U5U5U5_ARGB , SCE_GXM_COLOR_FORMAT_U1U5U5U5_ARGB }, // RGBA16
|
||||||
{ 64, SCE_GXM_COLOR_FORMAT_A8R8G8B8 , SCE_GXM_COLOR_FORMAT_A8R8G8B8 }, // RGBA_FLOAT // not supported
|
{ 32, SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ARGB , SCE_GXM_COLOR_FORMAT_A8R8G8B8 }, // RGBA
|
||||||
{ 64, SCE_GXM_COLOR_FORMAT_A8R8G8B8 , SCE_GXM_COLOR_FORMAT_A8R8G8B8 }, // RGBA_HALF
|
{ 32, SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ARGB , SCE_GXM_COLOR_FORMAT_A8R8G8B8 }, // RGBA
|
||||||
|
// { 64, SCE_GXM_TEXTURE_FORMAT_F16F16F16F16_ARGB , SCE_GXM_COLOR_FORMAT_F16F16F16F16_RGBA }, // RGBA_FLOAT // not supported
|
||||||
|
// { 64, SCE_GXM_TEXTURE_FORMAT_F16F16F16F16_ARGB , SCE_GXM_COLOR_FORMAT_F16F16F16F16_RGBA }, // RGBA_HALF
|
||||||
{ 32, SCE_GXM_TEXTURE_FORMAT_F32M_R , SCE_GXM_DEPTH_STENCIL_FORMAT_DF32 }, // DEPTH
|
{ 32, SCE_GXM_TEXTURE_FORMAT_F32M_R , SCE_GXM_DEPTH_STENCIL_FORMAT_DF32 }, // DEPTH
|
||||||
{ 32, SCE_GXM_TEXTURE_FORMAT_F32M_R , SCE_GXM_DEPTH_STENCIL_FORMAT_DF32 }, // SHADOW
|
{ 32, SCE_GXM_TEXTURE_FORMAT_F32M_R , SCE_GXM_DEPTH_STENCIL_FORMAT_DF32 }, // SHADOW
|
||||||
};
|
};
|
||||||
@@ -667,8 +671,6 @@ namespace GAPI {
|
|||||||
SCE_GXM_DEPTH_STENCIL_SURFACE_TILED,
|
SCE_GXM_DEPTH_STENCIL_SURFACE_TILED,
|
||||||
aWidth, this->data, NULL);
|
aWidth, this->data, NULL);
|
||||||
|
|
||||||
sceGxmDepthStencilSurfaceSetForceStoreMode ( &depthSurface, SCE_GXM_DEPTH_STENCIL_FORCE_STORE_ENABLED );
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sceGxmColorSurfaceInit(&colorSurface,
|
sceGxmColorSurfaceInit(&colorSurface,
|
||||||
SceGxmColorFormat(desc.targetFormat),
|
SceGxmColorFormat(desc.targetFormat),
|
||||||
@@ -738,6 +740,10 @@ namespace GAPI {
|
|||||||
if (active.textures[sampler] != this) {
|
if (active.textures[sampler] != this) {
|
||||||
active.textures[sampler] = this;
|
active.textures[sampler] = this;
|
||||||
sceGxmSetFragmentTexture(Context::gxmContext, sampler, &ID);
|
sceGxmSetFragmentTexture(Context::gxmContext, sampler, &ID);
|
||||||
|
|
||||||
|
if (opt & OPT_VERTEX) {
|
||||||
|
sceGxmSetVertexTexture(Context::gxmContext, sampler, &ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -999,8 +1005,8 @@ namespace GAPI {
|
|||||||
bool loadDepth = (Core::reqTarget.op & RT_LOAD_DEPTH);
|
bool loadDepth = (Core::reqTarget.op & RT_LOAD_DEPTH);
|
||||||
bool storeDepth = (Core::reqTarget.op & RT_STORE_DEPTH);
|
bool storeDepth = (Core::reqTarget.op & RT_STORE_DEPTH);
|
||||||
|
|
||||||
//sceGxmDepthStencilSurfaceSetForceLoadMode ( &target->depthSurface, loadDepth ? SCE_GXM_DEPTH_STENCIL_FORCE_LOAD_ENABLED : SCE_GXM_DEPTH_STENCIL_FORCE_LOAD_DISABLED );
|
sceGxmDepthStencilSurfaceSetForceLoadMode ( &target->depthSurface, loadDepth ? SCE_GXM_DEPTH_STENCIL_FORCE_LOAD_ENABLED : SCE_GXM_DEPTH_STENCIL_FORCE_LOAD_DISABLED );
|
||||||
//sceGxmDepthStencilSurfaceSetForceStoreMode ( &target->depthSurface, storeDepth ? SCE_GXM_DEPTH_STENCIL_FORCE_STORE_ENABLED : SCE_GXM_DEPTH_STENCIL_FORCE_STORE_DISABLED );
|
sceGxmDepthStencilSurfaceSetForceStoreMode ( &target->depthSurface, storeDepth ? SCE_GXM_DEPTH_STENCIL_FORCE_STORE_ENABLED : SCE_GXM_DEPTH_STENCIL_FORCE_STORE_DISABLED );
|
||||||
|
|
||||||
sceGxmBeginScene(Context::gxmContext, 0, target->renderTarget, NULL, NULL, NULL, colorSurface, &target->depthSurface);
|
sceGxmBeginScene(Context::gxmContext, 0, target->renderTarget, NULL, NULL, NULL, colorSurface, &target->depthSurface);
|
||||||
|
|
||||||
@@ -1155,6 +1161,9 @@ namespace GAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec4 copyPixel(int x, int y) {
|
vec4 copyPixel(int x, int y) {
|
||||||
|
// GAPI::Texture *t = Core::active.target;
|
||||||
|
// Color32 *color = (Color32*)t->data;
|
||||||
|
// return vec4(color->r, color->g, color->b, 255.0f) * (1.0f / 255.0f);
|
||||||
return vec4(0.0f); // TODO: read from framebuffer
|
return vec4(0.0f); // TODO: read from framebuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1137,16 +1137,17 @@ struct Inventory {
|
|||||||
|
|
||||||
bool ready = active && phaseRing == 1.0f && phasePage == 1.0f;
|
bool ready = active && phaseRing == 1.0f && phasePage == 1.0f;
|
||||||
|
|
||||||
Input::Joystick &joy = Input::joy[Core::settings.controls[playerIndex].joyIndex];
|
Input::Joystick &joy = Input::joy[Core::settings.controls[playerIndex].joyIndex];
|
||||||
|
Input::Joystick &joyMain = Input::joy[0];
|
||||||
|
|
||||||
ControlKey key = cMAX;
|
ControlKey key = cMAX;
|
||||||
if (Input::down[ikCtrl] || Input::down[ikEnter] || Input::lastState[playerIndex] == cAction || joy.down[jkA])
|
if (Input::down[ikCtrl] || Input::down[ikEnter] || Input::lastState[playerIndex] == cAction || joy.down[jkA])
|
||||||
key = cAction;
|
key = cAction;
|
||||||
else if (Input::down[ikAlt] || joy.down[jkB] || Input::lastState[playerIndex] == cInventory)
|
else if (Input::down[ikAlt] || joy.down[jkB] || Input::lastState[playerIndex] == cInventory)
|
||||||
key = cInventory;
|
key = cInventory;
|
||||||
else if (Input::down[ikLeft] || joy.down[jkLeft] || joy.L.x < -0.5f)
|
else if (Input::down[ikLeft] || joy.down[jkLeft] || joy.L.x < -0.5f || joyMain.down[jkLeft] || joyMain.L.x < -0.5f)
|
||||||
key = cLeft;
|
key = cLeft;
|
||||||
else if (Input::down[ikRight] || joy.down[jkRight] || joy.L.x > 0.5f)
|
else if (Input::down[ikRight] || joy.down[jkRight] || joy.L.x > 0.5f || joyMain.down[jkRight] || joyMain.L.x > 0.5f)
|
||||||
key = cRight;
|
key = cRight;
|
||||||
else if (Input::down[ikUp] || joy.down[jkUp] || joy.L.y < -0.5f)
|
else if (Input::down[ikUp] || joy.down[jkUp] || joy.L.y < -0.5f)
|
||||||
key = cUp;
|
key = cUp;
|
||||||
@@ -1854,8 +1855,6 @@ struct Inventory {
|
|||||||
// items
|
// items
|
||||||
game->setupBinding();
|
game->setupBinding();
|
||||||
|
|
||||||
Core::mLightProj.identity();
|
|
||||||
|
|
||||||
setupCamera(aspect);
|
setupCamera(aspect);
|
||||||
|
|
||||||
UI::setupInventoryShading();
|
UI::setupInventoryShading();
|
||||||
|
14
src/level.h
14
src/level.h
@@ -339,9 +339,12 @@ struct Level : IGame {
|
|||||||
|
|
||||||
void initShadow() {
|
void initShadow() {
|
||||||
delete shadow;
|
delete shadow;
|
||||||
if (Core::settings.detail.shadows > Core::Settings::LOW)
|
if (Core::settings.detail.shadows > Core::Settings::LOW) {
|
||||||
shadow = new Texture(SHADOW_TEX_WIDTH, SHADOW_TEX_HEIGHT, FMT_SHADOW, OPT_TARGET);
|
if (level.isTitle())
|
||||||
else
|
shadow = new Texture(32, 32, FMT_SHADOW); // init dummy shadow map
|
||||||
|
else
|
||||||
|
shadow = new Texture(SHADOW_TEX_SIZE, SHADOW_TEX_SIZE, FMT_SHADOW, OPT_TARGET);
|
||||||
|
} else
|
||||||
shadow = NULL;
|
shadow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,6 +554,7 @@ struct Level : IGame {
|
|||||||
Core::whiteTex->bind(sMask);
|
Core::whiteTex->bind(sMask);
|
||||||
Core::whiteTex->bind(sReflect);
|
Core::whiteTex->bind(sReflect);
|
||||||
Core::whiteCube->bind(sEnvironment);
|
Core::whiteCube->bind(sEnvironment);
|
||||||
|
if (shadow) shadow->bind(sShadow);
|
||||||
Core::basis.identity();
|
Core::basis.identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,6 +850,8 @@ struct Level : IGame {
|
|||||||
needRedrawTitleBG = false;
|
needRedrawTitleBG = false;
|
||||||
needRedrawReflections = true;
|
needRedrawReflections = true;
|
||||||
|
|
||||||
|
initShadow();
|
||||||
|
|
||||||
if (!(lastTitle = level.isTitle())) {
|
if (!(lastTitle = level.isTitle())) {
|
||||||
ASSERT(players[0] != NULL);
|
ASSERT(players[0] != NULL);
|
||||||
player = players[0];
|
player = players[0];
|
||||||
@@ -860,8 +866,6 @@ struct Level : IGame {
|
|||||||
ambientCache->getAmbient(players[0]->getRoomIndex(), players[0]->pos, cube); // add to queue
|
ambientCache->getAmbient(players[0]->getRoomIndex(), players[0]->pos, cube); // add to queue
|
||||||
}
|
}
|
||||||
|
|
||||||
initShadow();
|
|
||||||
|
|
||||||
for (int i = 0; i < level.soundSourcesCount; i++) {
|
for (int i = 0; i < level.soundSourcesCount; i++) {
|
||||||
TR::SoundSource &src = level.soundSources[i];
|
TR::SoundSource &src = level.soundSources[i];
|
||||||
int flags = Sound::PAN;
|
int flags = Sound::PAN;
|
||||||
|
1
src/platform/psv/deploy.bat
Normal file
1
src/platform/psv/deploy.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl --ftp-method nocwd -T OpenLara.self ftp://192.168.1.39:1337/ux0:/app/OPENLARA1/eboot.bin
|
BIN
src/platform/psv/sce_sys/icon0.png
Normal file
BIN
src/platform/psv/sce_sys/icon0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 896 B |
BIN
src/platform/psv/sce_sys/livearea/contents/bg.png
Normal file
BIN
src/platform/psv/sce_sys/livearea/contents/bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
src/platform/psv/sce_sys/livearea/contents/startup.png
Normal file
BIN
src/platform/psv/sce_sys/livearea/contents/startup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 924 B |
11
src/platform/psv/sce_sys/livearea/contents/template.xml
Normal file
11
src/platform/psv/sce_sys/livearea/contents/template.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<livearea style="a1" format-ver="01.00" content-rev="1">
|
||||||
|
<livearea-background>
|
||||||
|
<image>bg.png</image>
|
||||||
|
</livearea-background>
|
||||||
|
|
||||||
|
<gate>
|
||||||
|
<startup-image>startup.png</startup-image>
|
||||||
|
</gate>
|
||||||
|
</livearea>
|
@@ -17,20 +17,20 @@ psp2cgc -profile sce_vp_psp2 -W4 -Wperf -pedantic -o gxm/clear_vp.gxp clear.hlsl
|
|||||||
psp2cgc -profile sce_fp_psp2 -W4 -Wperf -pedantic -o gxm/clear_fp.gxp clear.hlsl -DPIXEL
|
psp2cgc -profile sce_fp_psp2 -W4 -Wperf -pedantic -o gxm/clear_fp.gxp clear.hlsl -DPIXEL
|
||||||
|
|
||||||
cd gxm
|
cd gxm
|
||||||
C:\pspsdk\bin\bin2c.exe compose_vp.gxp compose_vp.h COMPOSE_VP
|
..\bin2c.exe compose_vp.gxp compose_vp.h COMPOSE_VP
|
||||||
C:\pspsdk\bin\bin2c.exe compose_fp.gxp compose_fp.h COMPOSE_FP
|
..\bin2c.exe compose_fp.gxp compose_fp.h COMPOSE_FP
|
||||||
C:\pspsdk\bin\bin2c.exe shadow_vp.gxp shadow_vp.h SHADOW_VP
|
..\bin2c.exe shadow_vp.gxp shadow_vp.h SHADOW_VP
|
||||||
C:\pspsdk\bin\bin2c.exe shadow_fp.gxp shadow_fp.h SHADOW_FP
|
..\bin2c.exe shadow_fp.gxp shadow_fp.h SHADOW_FP
|
||||||
C:\pspsdk\bin\bin2c.exe ambient_vp.gxp ambient_vp.h AMBIENT_VP
|
..\bin2c.exe ambient_vp.gxp ambient_vp.h AMBIENT_VP
|
||||||
C:\pspsdk\bin\bin2c.exe ambient_fp.gxp ambient_fp.h AMBIENT_FP
|
..\bin2c.exe ambient_fp.gxp ambient_fp.h AMBIENT_FP
|
||||||
C:\pspsdk\bin\bin2c.exe water_vp.gxp water_vp.h WATER_VP
|
..\bin2c.exe water_vp.gxp water_vp.h WATER_VP
|
||||||
C:\pspsdk\bin\bin2c.exe water_fp.gxp water_fp.h WATER_FP
|
..\bin2c.exe water_fp.gxp water_fp.h WATER_FP
|
||||||
C:\pspsdk\bin\bin2c.exe filter_vp.gxp filter_vp.h FILTER_VP
|
..\bin2c.exe filter_vp.gxp filter_vp.h FILTER_VP
|
||||||
C:\pspsdk\bin\bin2c.exe filter_fp.gxp filter_fp.h FILTER_FP
|
..\bin2c.exe filter_fp.gxp filter_fp.h FILTER_FP
|
||||||
C:\pspsdk\bin\bin2c.exe gui_vp.gxp gui_vp.h GUI_VP
|
..\bin2c.exe gui_vp.gxp gui_vp.h GUI_VP
|
||||||
C:\pspsdk\bin\bin2c.exe gui_fp.gxp gui_fp.h GUI_FP
|
..\bin2c.exe gui_fp.gxp gui_fp.h GUI_FP
|
||||||
C:\pspsdk\bin\bin2c.exe clear_vp.gxp clear_vp.h CLEAR_VP
|
..\bin2c.exe clear_vp.gxp clear_vp.h CLEAR_VP
|
||||||
C:\pspsdk\bin\bin2c.exe clear_fp.gxp clear_fp.h CLEAR_FP
|
..\bin2c.exe clear_fp.gxp clear_fp.h CLEAR_FP
|
||||||
|
|
||||||
|
|
||||||
cd ..
|
cd ..
|
@@ -12,7 +12,7 @@ struct VS_OUTPUT {
|
|||||||
float4 light : TEXCOORD7;
|
float4 light : TEXCOORD7;
|
||||||
float4 lightProj : TEXCOORD8;
|
float4 lightProj : TEXCOORD8;
|
||||||
#ifdef _GAPI_GXM
|
#ifdef _GAPI_GXM
|
||||||
//float clipDist : CLP0;
|
float clipDist : CLP0;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,9 +129,17 @@ VS_OUTPUT main(VS_INPUT In) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Out.pos = mul(uViewProj, float4(Out.coord, rBasisPos.w));
|
Out.pos = mul(uViewProj, float4(Out.coord, rBasisPos.w));
|
||||||
Out.lightProj = mul(uLightProj, float4(Out.coord, 1.0));
|
Out.lightProj = mul(uLightProj, float4(Out.coord, 1.0));
|
||||||
|
/*
|
||||||
|
if (TYPE_ROOM) {
|
||||||
|
float3 lightVec = uLightPos[0].xyz - Out.coord;
|
||||||
|
if (dot(Out.normal.xyz, lightVec) < 0.0) {
|
||||||
|
Out.lightProj.w = -1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
#ifdef _GAPI_GXM
|
#ifdef _GAPI_GXM
|
||||||
//Out.clipDist = uParam.w - Out.viewVec.w;
|
Out.clipDist = uParam.w - Out.viewVec.w;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Out;
|
return Out;
|
||||||
@@ -141,23 +149,24 @@ Out.lightProj = mul(uLightProj, float4(Out.coord, 1.0));
|
|||||||
|
|
||||||
float SHADOW(float2 p) {
|
float SHADOW(float2 p) {
|
||||||
#ifdef SHADOW_DEPTH
|
#ifdef SHADOW_DEPTH
|
||||||
return tex2D(sShadow, p).x;
|
return tex2Dlod(sShadow, float4(p, 0, 0)).x;
|
||||||
#else
|
#else
|
||||||
return unpack(tex2D(sShadow, p));
|
return unpack(tex2Dlod(sShadow, float4(p, 0, 0)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float getShadow(float3 lightVec, float3 normal, float4 lightProj) {
|
float getShadow(float3 lightVec, float3 normal, float4 lightProj) {
|
||||||
|
/*
|
||||||
float sMin = min(lightProj.x, lightProj.y);
|
float sMin = min(lightProj.x, lightProj.y);
|
||||||
float sMax = max(lightProj.x, lightProj.y);
|
float sMax = max(lightProj.x, lightProj.y);
|
||||||
|
float vis = lightProj.w;
|
||||||
//float vis = lightProj.w;
|
if (TYPE_ROOM) {
|
||||||
//if (TYPE_ROOM) {
|
vis = min(vis, dot(normal, lightVec));
|
||||||
// vis = min(vis, dot(normal, lightVec));
|
}
|
||||||
//}
|
sMin = min(vis, sMin);
|
||||||
//sMin = min(vis, sMin);
|
*/
|
||||||
|
float factor = step(0.0, lightProj.w); //float((sMin > 0.0f) && (sMax < lightProj.w)); //
|
||||||
float factor = step(0.0, lightProj.w); //((sMin > 0.0f) && (sMax < lightProj.w));
|
lightProj.xyz *= factor;
|
||||||
|
|
||||||
#ifdef _GAPI_GXM
|
#ifdef _GAPI_GXM
|
||||||
lightProj.z += SHADOW_CONST_BIAS * SHADOW_TEXEL.x * lightProj.w;
|
lightProj.z += SHADOW_CONST_BIAS * SHADOW_TEXEL.x * lightProj.w;
|
||||||
@@ -182,7 +191,7 @@ float getShadow(float3 lightVec, float3 normal, float4 lightProj) {
|
|||||||
float rShadow = lerp(samples.x, samples.y, f.y);
|
float rShadow = lerp(samples.x, samples.y, f.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rShadow = lerp(1.0, rShadow, factor);
|
//rShadow = lerp(1.0, rShadow, factor);
|
||||||
|
|
||||||
float fade = saturate(dot(lightVec, lightVec));
|
float fade = saturate(dot(lightVec, lightVec));
|
||||||
return rShadow + (1.0 - rShadow) * fade;
|
return rShadow + (1.0 - rShadow) * fade;
|
||||||
@@ -207,7 +216,7 @@ float getContactAO(float3 p, float3 n) {
|
|||||||
|
|
||||||
float calcCaustics(float3 coord, float3 n) {
|
float calcCaustics(float3 coord, float3 n) {
|
||||||
float2 cc = saturate((coord.xz - uRoomSize.xy) / uRoomSize.zw);
|
float2 cc = saturate((coord.xz - uRoomSize.xy) / uRoomSize.zw);
|
||||||
return tex2D(sReflect, float2(cc.x, 1.0 - cc.y)).x * max(0.0, -n.y);
|
return tex2Dlod(sReflect, float4(cc.x, 1.0 - cc.y, 0, 0)).x * max(0.0, -n.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
float calcSpecular(float3 normal, float3 viewVec, float3 lightVec, float intensity) {
|
float calcSpecular(float3 normal, float3 viewVec, float3 lightVec, float intensity) {
|
||||||
@@ -220,14 +229,6 @@ float calcSpecular(float3 normal, float3 viewVec, float3 lightVec, float intensi
|
|||||||
float4 main(VS_OUTPUT In) : COLOR0 {
|
float4 main(VS_OUTPUT In) : COLOR0 {
|
||||||
float2 uv = In.texCoord.xy;
|
float2 uv = In.texCoord.xy;
|
||||||
|
|
||||||
#ifndef _GAPI_GXM
|
|
||||||
if (CLIP_PLANE) {
|
|
||||||
if (In.viewVec.w > uParam.w) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!TYPE_SPRITE) {
|
if (!TYPE_SPRITE) {
|
||||||
uv /= In.texCoord.zw;
|
uv /= In.texCoord.zw;
|
||||||
}
|
}
|
||||||
@@ -246,6 +247,14 @@ float4 main(VS_OUTPUT In) : COLOR0 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _GAPI_GXM
|
||||||
|
if (CLIP_PLANE) {
|
||||||
|
if (In.viewVec.w > uParam.w) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
color *= In.diffuse;
|
color *= In.diffuse;
|
||||||
|
|
||||||
if (TYPE_FLASH) {
|
if (TYPE_FLASH) {
|
||||||
|
@@ -33,7 +33,7 @@ float4 downsample(float2 uv) { // uParam (1 / textureSize, unused, unused, unuse
|
|||||||
for (float y = -1.5; y < 2.0; y++) {
|
for (float y = -1.5; y < 2.0; y++) {
|
||||||
for (float x = -1.5; x < 2.0; x++) {
|
for (float x = -1.5; x < 2.0; x++) {
|
||||||
float4 p;
|
float4 p;
|
||||||
p.xyz = tex2D(sDiffuse, uv + float2(x, y) * uParam.x).xyz;
|
p.xyz = tex2Dlod(sDiffuse, float4(uv + float2(x, y) * uParam.x, 0, 0)).xyz;
|
||||||
p.w = dot(p.xyz, float3(0.299, 0.587, 0.114));
|
p.w = dot(p.xyz, float3(0.299, 0.587, 0.114));
|
||||||
p.xyz *= p.w;
|
p.xyz *= p.w;
|
||||||
color += p;
|
color += p;
|
||||||
|
@@ -182,7 +182,7 @@ float4 rays(VS_OUTPUT In, float2 pixelCoord) {
|
|||||||
float3 p0 = uViewPos.xyz - viewVec * t;
|
float3 p0 = uViewPos.xyz - viewVec * t;
|
||||||
float3 p1 = In.coord.xyz;
|
float3 p1 = In.coord.xyz;
|
||||||
|
|
||||||
float dither = tex2D(sMask, pixelCoord * (1.0 / 8.0)).x;
|
float dither = tex2Dlod(sMask, float4(pixelCoord * (1.0 / 8.0), 0, 0)).x;
|
||||||
|
|
||||||
float3 delta = (p1 - p0) / RAY_STEPS;
|
float3 delta = (p1 - p0) / RAY_STEPS;
|
||||||
float3 pos = p0 + delta * dither;
|
float3 pos = p0 + delta * dither;
|
||||||
@@ -191,7 +191,7 @@ float4 rays(VS_OUTPUT In, float2 pixelCoord) {
|
|||||||
for (float i = 0.0; i < RAY_STEPS; i++) {
|
for (float i = 0.0; i < RAY_STEPS; i++) {
|
||||||
float3 wpos = (pos - uPosScale[0].xyz) / uPosScale[1].xyz;
|
float3 wpos = (pos - uPosScale[0].xyz) / uPosScale[1].xyz;
|
||||||
float2 tc = wpos.xz * 0.5 + 0.5;
|
float2 tc = wpos.xz * 0.5 + 0.5;
|
||||||
float light = tex2D(sReflect, tc).x;
|
float light = tex2Dlod(sReflect, float4(tc, 0, 0)).x;
|
||||||
sum += light * (1.0 - (clamp(wpos.y, -1.0, 1.0) * 0.5 + 0.5));
|
sum += light * (1.0 - (clamp(wpos.y, -1.0, 1.0) * 0.5 + 0.5));
|
||||||
pos += delta;
|
pos += delta;
|
||||||
}
|
}
|
||||||
@@ -235,14 +235,14 @@ float4 compose(VS_OUTPUT In) {
|
|||||||
color.xyz *= lerp(float3(1.0, 1.0, 1.0), UNDERWATER_COLOR, clamp(dist * WATER_COLOR_DIST, 0.0, 2.0));
|
color.xyz *= lerp(float3(1.0, 1.0, 1.0), UNDERWATER_COLOR, clamp(dist * WATER_COLOR_DIST, 0.0, 2.0));
|
||||||
float fog = saturate(1.0 / exp(dist * WATER_FOG_DIST));
|
float fog = saturate(1.0 / exp(dist * WATER_FOG_DIST));
|
||||||
color.xyz = lerp(UNDERWATER_COLOR * 0.2, color.xyz, fog);
|
color.xyz = lerp(UNDERWATER_COLOR * 0.2, color.xyz, fog);
|
||||||
return float4(tex2D(sReflect, tc.xy).xyz, 1.0); // color
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _GAPI_GXM
|
#ifdef _GAPI_GXM
|
||||||
float4 main(VS_OUTPUT In, float4 pixelCoord: VPOS) : COLOR0 {
|
|
||||||
#else
|
|
||||||
float4 main(VS_OUTPUT In) : COLOR0 {
|
float4 main(VS_OUTPUT In) : COLOR0 {
|
||||||
float2 pixelCoord = float2(__pixel_x(), __pixel_y());
|
float2 pixelCoord = float2(__pixel_x(), __pixel_y());
|
||||||
|
#else
|
||||||
|
float4 main(VS_OUTPUT In, float4 pixelCoord: VPOS) : COLOR0 {
|
||||||
#endif
|
#endif
|
||||||
if (WATER_DROP)
|
if (WATER_DROP)
|
||||||
return drop(In);
|
return drop(In);
|
||||||
|
5
src/ui.h
5
src/ui.h
@@ -635,7 +635,10 @@ namespace UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setupInventoryShading() {
|
void setupInventoryShading() {
|
||||||
Core::whiteTex->bind(sShadow);
|
Core::mView.identity();
|
||||||
|
Core::mProj = GAPI::perspective(1.0f, 1.0f, 1.0f, 2.0f);
|
||||||
|
Core::mLightProj = Core::mProj * Core::mView;
|
||||||
|
|
||||||
game->setShader(Core::passCompose, Shader::ENTITY, false, false);
|
game->setShader(Core::passCompose, Shader::ENTITY, false, false);
|
||||||
Core::setMaterial(1.0f, 0.0f, 0.0f, 1.0f);
|
Core::setMaterial(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user