timecycle; some rendering

This commit is contained in:
aap 2021-01-08 13:34:49 +01:00
parent ebdf08a514
commit 37a58a04f2
33 changed files with 688 additions and 318 deletions

View File

@ -241,7 +241,7 @@ CFileMgr::SetDirMyDocuments(void)
}
ssize_t
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
CFileMgr::LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode)
{
int fd;
ssize_t n, len;
@ -257,6 +257,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
return -1;
#endif
len += n;
assert(len < maxlen);
}while(n == 0x4000);
buf[len] = 0;
myfclose(fd);

View File

@ -9,7 +9,7 @@ public:
static void ChangeDir(const char *dir);
static void SetDir(const char *dir);
static void SetDirMyDocuments(void);
static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static ssize_t LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode);
static int OpenFile(const char *file, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);

View File

@ -541,7 +541,12 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
// Txd and anim have to be loaded
int animId = mi->GetAnimFileIndex();
#ifdef FIX_BUGS
if(!HasTxdLoaded(mi->GetTxdSlot()) ||
#else
// texDict will exist even if only first part has loaded
if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil ||
#endif
animId != -1 && !CAnimManager::GetAnimationBlock(animId)->isLoaded){
RemoveModel(streamId);
ReRequestModel(streamId);

View File

@ -71,7 +71,7 @@ enum Config {
PATHNODESIZE = 4500,
NUMWEATHERS = 7,
NUMWEATHERS = 8,
NUMHOURS = 24,
NUMEXTRADIRECTIONALS = 4,

View File

@ -76,7 +76,7 @@
GlobalScene Scene;
uint8 work_buff[55000];
uint8 work_buff[55000 * 2];
char gString[256];
char gString2[512];
wchar gUString[256];

View File

@ -7,7 +7,7 @@ struct GlobalScene
};
extern GlobalScene Scene;
extern uint8 work_buff[55000];
extern uint8 work_buff[55000 * 2];
extern char gString[256];
extern char gString2[512];
extern wchar gUString[256];

View File

@ -36,7 +36,13 @@ enum {
VSLOC_eye = rw::d3d::VSLOC_afterLights,
VSLOC_reflProps,
VSLOC_specLights
VSLOC_specLights,
// Leeds building
VSLOC_emissive = rw::d3d::VSLOC_afterLights,
VSLOC_ambient,
PSLOC_colorscale = 1
};
/*
@ -182,11 +188,11 @@ DestroyVehiclePipe(void)
/*
* Neo World pipe
* Leeds World pipe
*/
static void *neoWorld_VS;
static void *neoWorldVC_PS;
static void *leedsBuilding_VS;
static void *scale_PS;
static void
worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
@ -195,79 +201,67 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
using namespace rw::d3d;
using namespace rw::d3d9;
if(!LightmapEnable){
defaultRenderCB_Shader(atomic, header);
return;
}
int vsBits;
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
setIndices(header->indexBuffer);
setVertexDeclaration(header->vertexDeclaration);
vsBits = lightingCB_Shader(atomic);
setVertexShader(leedsBuilding_VS);
setPixelShader(scale_PS);
uploadMatrices(atomic->getFrame()->getLTM());
RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
float lightfactor[4];
d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1);
d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1);
float colorscale[4];
colorscale[3] = 1.0f;
InstanceData *inst = header->inst;
for(rw::uint32 i = 0; i < header->numMeshes; i++){
Material *m = inst->material;
if(MatFX::getEffects(m) == MatFX::DUAL){
setVertexShader(neoWorld_VS);
MatFX *matfx = MatFX::get(m);
Texture *dualtex = matfx->getDualTexture();
if(dualtex == nil)
goto notex;
d3d::setTexture(1, dualtex);
lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult;
}else{
notex:
setVertexShader(default_amb_VS);
d3d::setTexture(1, nil);
lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f;
}
lightfactor[3] = m->color.alpha/255.0f;
d3d::setTexture(0, m->texture);
d3ddevice->SetPixelShaderConstantF(1, lightfactor, 1);
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
RGBA color = { 255, 255, 255, m->color.alpha };
setMaterial(color, m->surfaceProps);
float cs = 1.0f;
if(m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
if(m->texture)
d3d::setTexture(0, m->texture);
else
d3d::setTexture(0, gpWhiteTexture);
setPixelShader(neoWorldVC_PS);
d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this
setMaterial(m->color, m->surfaceProps, 0.5f);
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
drawInst(header, inst);
inst++;
}
d3d::setTexture(1, nil);
}
void
CreateWorldPipe(void)
{
if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n");
else
ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
#include "shaders/default_UV2_VS.inc"
neoWorld_VS = rw::d3d::createVertexShader(default_UV2_VS_cso);
assert(neoWorld_VS);
#include "shaders/neoWorldVC_PS.inc"
neoWorldVC_PS = rw::d3d::createPixelShader(neoWorldVC_PS_cso);
assert(neoWorldVC_PS);
// if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
// printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n");
// else
// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
#include "shaders/leedsBuilding_VS.inc"
leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso);
assert(leedsBuilding_VS);
#include "shaders/scale_PS.inc"
scale_PS = rw::d3d::createPixelShader(scale_PS_cso);
assert(scale_PS);
rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create();
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
@ -279,10 +273,10 @@ CreateWorldPipe(void)
void
DestroyWorldPipe(void)
{
rw::d3d::destroyVertexShader(neoWorld_VS);
neoWorld_VS = nil;
rw::d3d::destroyPixelShader(neoWorldVC_PS);
neoWorldVC_PS = nil;
rw::d3d::destroyVertexShader(leedsBuilding_VS);
leedsBuilding_VS = nil;
rw::d3d::destroyPixelShader(scale_PS);
scale_PS = nil;
((rw::d3d9::ObjPipeline*)worldPipe)->destroy();

View File

@ -33,6 +33,10 @@ static int32 u_reflProps;
static int32 u_specDir;
static int32 u_specColor;
static int32 u_amb;
static int32 u_emiss;
static int32 u_colorscale;
#define U(i) currentShader->uniformLocations[i]
/*
@ -189,10 +193,10 @@ DestroyVehiclePipe(void)
/*
* Neo World pipe
* Leeds World pipe
*/
rw::gl3::Shader *neoWorldShader;
rw::gl3::Shader *leedsWorldShader;
static void
worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
@ -200,15 +204,9 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
using namespace rw;
using namespace rw::gl3;
if(!LightmapEnable){
gl3::defaultRenderCB(atomic, header);
return;
}
Material *m;
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
@ -221,39 +219,39 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
neoWorldShader->use();
leedsWorldShader->use();
float lightfactor[4];
RGBAf amb, emiss;
amb.red = CTimeCycle::GetAmbientRed();
amb.green = CTimeCycle::GetAmbientGreen();
amb.blue = CTimeCycle::GetAmbientBlue();
amb.alpha = 1.0f;
emiss = pAmbient->color;
glUniform4fv(U(u_amb), 1, (float*)&amb);
glUniform4fv(U(u_emiss), 1, (float*)&emiss);
float colorscale[4];
colorscale[3] = 1.0f;
while(n--){
m = inst->material;
if(MatFX::getEffects(m) == MatFX::DUAL){
MatFX *matfx = MatFX::get(m);
Texture *dualtex = matfx->getDualTexture();
if(dualtex == nil)
goto notex;
setTexture(1, dualtex);
lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult;
}else{
notex:
setTexture(1, nil);
lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f;
}
lightfactor[3] = m->color.alpha/255.0f;
glUniform4fv(U(u_lightMap), 1, lightfactor);
RGBA color = { 255, 255, 255, m->color.alpha };
setMaterial(color, m->surfaceProps);
float cs = 1.0f;
if(m->texture)
cs = 255/128.0f;
colorscale[0] = colorscale[1] = colorscale[2] = cs;
glUniform4fv(U(u_colorscale), 1, colorscale);
setTexture(0, m->texture);
setMaterial(m->color, m->surfaceProps);
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
drawInst(header, inst);
inst++;
}
setTexture(1, nil);
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
@ -265,18 +263,18 @@ CreateWorldPipe(void)
using namespace rw;
using namespace rw::gl3;
if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n");
else
ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
// if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
// printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n");
// else
// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
{
#include "shaders/neoWorldVC_fs_gl.inc"
#include "shaders/default_UV2_gl.inc"
const char *vs[] = { shaderDecl, header_vert_src, default_UV2_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, neoWorldVC_frag_src, nil };
neoWorldShader = Shader::create(vs, fs);
assert(neoWorldShader);
#include "shaders/scale_fs_gl.inc"
#include "shaders/leedsBuilding_vs_gl.inc"
const char *vs[] = { shaderDecl, header_vert_src, leedsBuilding_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil };
leedsWorldShader = Shader::create(vs, fs);
assert(leedsWorldShader);
}
@ -290,8 +288,8 @@ CreateWorldPipe(void)
void
DestroyWorldPipe(void)
{
neoWorldShader->destroy();
neoWorldShader = nil;
leedsWorldShader->destroy();
leedsWorldShader = nil;
((rw::gl3::ObjPipeline*)worldPipe)->destroy();
worldPipe = nil;
@ -609,6 +607,10 @@ CustomPipeRegisterGL(void)
u_reflProps = rw::gl3::registerUniform("u_reflProps");
u_specDir = rw::gl3::registerUniform("u_specDir");
u_specColor = rw::gl3::registerUniform("u_specColor");
u_amb = rw::gl3::registerUniform("u_amb");
u_emiss = rw::gl3::registerUniform("u_emiss");
u_colorscale = rw::gl3::registerUniform("u_colorscale");
}

View File

@ -25,14 +25,14 @@ static RwIm2DVertex Vertex2[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
#ifdef RW_D3D9
void *colourfilterVC_PS;
void *colourfilterLCS_PS;
void *contrast_PS;
#endif
#ifdef RW_OPENGL
int32 u_blurcolor;
int32 u_contrastAdd;
int32 u_contrastMult;
rw::gl3::Shader *colourFilterVC;
rw::gl3::Shader *colourFilterLCS;
rw::gl3::Shader *contrast;
#endif
@ -143,8 +143,8 @@ CPostFX::Open(RwCamera *cam)
#ifdef RW_D3D9
#include "shaders/colourfilterVC_PS.inc"
colourfilterVC_PS = rw::d3d::createPixelShader(colourfilterVC_PS_cso);
#include "shaders/colourfilterLCS_PS.inc"
colourfilterLCS_PS = rw::d3d::createPixelShader(colourfilterLCS_PS_cso);
#include "shaders/contrastPS.inc"
contrast_PS = rw::d3d::createPixelShader(contrastPS_cso);
#endif
@ -153,11 +153,11 @@ CPostFX::Open(RwCamera *cam)
{
#include "shaders/im2d_gl.inc"
#include "shaders/colourfilterVC_fs_gl.inc"
#include "shaders/colourfilterLCS_fs_gl.inc"
const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
const char *fs[] = { shaderDecl, header_frag_src, colourfilterVC_frag_src, nil };
colourFilterVC = Shader::create(vs, fs);
assert(colourFilterVC);
const char *fs[] = { shaderDecl, header_frag_src, colourfilterLCS_frag_src, nil };
colourFilterLCS = Shader::create(vs, fs);
assert(colourFilterLCS);
}
{
@ -184,9 +184,9 @@ CPostFX::Close(void)
pBackBuffer = nil;
}
#ifdef RW_D3D9
if(colourfilterVC_PS){
rw::d3d::destroyPixelShader(colourfilterVC_PS);
colourfilterVC_PS = nil;
if(colourfilterLCS_PS){
rw::d3d::destroyPixelShader(colourfilterLCS_PS);
colourfilterLCS_PS = nil;
}
if(contrast_PS){
rw::d3d::destroyPixelShader(contrast_PS);
@ -194,9 +194,9 @@ CPostFX::Close(void)
}
#endif
#ifdef RW_OPENGL
if(colourFilterVC){
colourFilterVC->destroy();
colourFilterVC = nil;
if(colourFilterLCS){
colourFilterLCS->destroy();
colourFilterLCS = nil;
}
if(contrast){
contrast->destroy();
@ -294,12 +294,12 @@ CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
blurcolors[3] = 30/255.0f;
#ifdef RW_D3D9
rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1);
rw::d3d::im2dOverridePS = colourfilterVC_PS;
rw::d3d::im2dOverridePS = colourfilterLCS_PS;
#endif
#ifdef RW_OPENGL
rw::gl3::im2dOverrideShader = colourFilterVC;
colourFilterVC->use();
glUniform4fv(colourFilterVC->uniformLocations[u_blurcolor], 1, blurcolors);
rw::gl3::im2dOverrideShader = colourFilterLCS;
colourFilterLCS->use();
glUniform4fv(colourFilterLCS->uniformLocations[u_blurcolor], 1, blurcolors);
#endif
}
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);

View File

@ -1,19 +1,20 @@
all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \
colourfilterVC_fs_gl.inc contrast_fs_gl.inc \
colourfilterLCS_fs_gl.inc contrast_fs_gl.inc \
neoRim_gl.inc neoRimSkin_gl.inc \
neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \
neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \
im2d_UV2_gl.inc screenDroplet_fs_gl.inc
im2d_UV2_gl.inc screenDroplet_fs_gl.inc \
leedsBuilding_vs_gl.inc scale_fs_gl.inc
im2d_gl.inc: im2d.vert
(echo 'const char *im2d_vert_src =';\
sed 's/..*/"&\\n"/' im2d.vert;\
echo ';') >im2d_gl.inc
colourfilterVC_fs_gl.inc: colourfilterVC.frag
(echo 'const char *colourfilterVC_frag_src =';\
sed 's/..*/"&\\n"/' colourfilterVC.frag;\
echo ';') >colourfilterVC_fs_gl.inc
colourfilterLCS_fs_gl.inc: colourfilterLCS.frag
(echo 'const char *colourfilterLCS_frag_src =';\
sed 's/..*/"&\\n"/' colourfilterLCS.frag;\
echo ';') >colourfilterLCS_fs_gl.inc
simple_fs_gl.inc: simple.frag
(echo 'const char *simple_frag_src =';\
sed 's/..*/"&\\n"/' simple.frag;\
@ -76,3 +77,13 @@ screenDroplet_fs_gl.inc: screenDroplet.frag
(echo 'const char *screenDroplet_frag_src =';\
sed 's/..*/"&\\n"/' screenDroplet.frag;\
echo ';') >screenDroplet_fs_gl.inc
leedsBuilding_vs_gl.inc: leedsBuilding.vert
(echo 'const char *leedsBuilding_vert_src =';\
sed 's/..*/"&\\n"/' leedsBuilding.vert;\
echo ';') >leedsBuilding_vs_gl.inc
scale_fs_gl.inc: scale.frag
(echo 'const char *scale_frag_src =';\
sed 's/..*/"&\\n"/' scale.frag;\
echo ';') >scale_fs_gl.inc

View File

@ -0,0 +1,20 @@
uniform sampler2D tex0;
uniform vec4 u_blurcolor;
FSIN vec4 v_color;
FSIN vec2 v_tex0;
FSIN float v_fog;
void
main(void)
{
vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
dst += dst*u_blurcolor;
vec4 color;
color.rgb = dst.rgb;
color.a = 1.0f;
FRAGCOLOR(color);
}

Binary file not shown.

View File

@ -0,0 +1,13 @@
sampler2D tex : register(s0);
float4 blurcol : register(c10);
//float4 blurcols[10] : register(c15);
float4 main(in float2 texcoord : TEXCOORD0) : COLOR0
{
float4 dst = tex2D(tex, texcoord.xy);
dst += dst*blurcol;
dst.a = 1.0;
return dst;
}

View File

@ -0,0 +1,27 @@
static unsigned char colourfilterLCS_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00,
0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72,
0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00,
0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d,
0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29,
0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e,
0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00,
0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80,
0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0,
0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80,
0xff, 0xff, 0x00, 0x00
};

View File

@ -0,0 +1,22 @@
const char *colourfilterLCS_frag_src =
"uniform sampler2D tex0;\n"
"uniform vec4 u_blurcolor;\n"
"FSIN vec4 v_color;\n"
"FSIN vec2 v_tex0;\n"
"FSIN float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" dst += dst*u_blurcolor;\n"
" vec4 color;\n"
" color.rgb = dst.rgb;\n"
" color.a = 1.0f;\n"
" FRAGCOLOR(color);\n"
"}\n"
;

View File

@ -1,27 +0,0 @@
uniform sampler2D tex0;
uniform vec4 u_blurcolor;
FSIN vec4 v_color;
FSIN vec2 v_tex0;
FSIN float v_fog;
void
main(void)
{
float a = u_blurcolor.a;
vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0);
vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
vec4 prev = dst;
for(int i = 0; i < 5; i++){
vec4 tmp = dst*(1.0-a) + prev*doublec*a;
tmp += prev*u_blurcolor;
tmp += prev*u_blurcolor;
prev = clamp(tmp, 0.0, 1.0);
}
vec4 color;
color.rgb = prev.rgb;
color.a = 1.0f;
FRAGCOLOR(color);
}

View File

@ -1,23 +0,0 @@
sampler2D tex : register(s0);
float4 blurcol : register(c10);
//float4 blurcols[10] : register(c15);
float4 main(in float2 texcoord : TEXCOORD0) : COLOR0
{
float a = blurcol.a;
float4 doublec = saturate(blurcol*2);
float4 dst = tex2D(tex, texcoord.xy);
float4 prev = dst;
for(int i = 0; i < 5; i++){
// float4 doublec = saturate(blurcol*2);
float4 tmp = dst*(1-a) + prev*doublec*a;
tmp += prev*blurcol;
tmp += prev*blurcol;
prev = saturate(tmp);
}
prev.a = 1.0f;
return prev;
}

View File

@ -1,56 +0,0 @@
static unsigned char colourfilterVC_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00,
0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72,
0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00,
0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d,
0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29,
0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e,
0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00,
0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40,
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x17, 0x80,
0x0a, 0x00, 0xe4, 0xa0, 0x0a, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03,
0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80,
0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xff, 0xa0,
0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0,
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80,
0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80,
0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80,
0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80,
0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02,
0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02,
0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
};

View File

@ -1,29 +0,0 @@
const char *colourfilterVC_frag_src =
"uniform sampler2D tex0;\n"
"uniform vec4 u_blurcolor;\n"
"FSIN vec4 v_color;\n"
"FSIN vec2 v_tex0;\n"
"FSIN float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" float a = u_blurcolor.a;\n"
" vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0);\n"
" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
" vec4 prev = dst;\n"
" for(int i = 0; i < 5; i++){\n"
" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n"
" tmp += prev*u_blurcolor;\n"
" tmp += prev*u_blurcolor;\n"
" prev = clamp(tmp, 0.0, 1.0);\n"
" }\n"
" vec4 color;\n"
" color.rgb = prev.rgb;\n"
" color.a = 1.0f;\n"
" FRAGCOLOR(color);\n"
"}\n"
;

View File

@ -0,0 +1,26 @@
uniform vec4 u_amb;
uniform vec4 u_emiss;
VSIN(ATTRIB_POS) vec3 in_pos;
VSOUT vec4 v_color;
VSOUT vec2 v_tex0;
VSOUT float v_fog;
void
main(void)
{
vec4 Vertex = u_world * vec4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
vec3 Normal = mat3(u_world) * in_normal;
v_tex0 = in_tex0;
v_color = in_color;
v_color.rgb *= u_amb.rgb;
v_color.rgb += u_emiss.rgb;
v_color = clamp(v_color, 0.0, 1.0);
v_color.a *= u_matColor.a;
v_fog = DoFog(gl_Position.w);
}

Binary file not shown.

View File

@ -0,0 +1,44 @@
#include "standardConstants.h"
float4 emissive : register(c41);
float4 ambient : register(c42);
struct VS_in
{
float4 Position : POSITION;
float3 Normal : NORMAL;
float2 TexCoord : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float4 Prelight : COLOR0;
};
struct VS_out {
float4 Position : POSITION;
float3 TexCoord0 : TEXCOORD0; // also fog
float2 TexCoord1 : TEXCOORD1;
float4 Color : COLOR0;
};
VS_out main(in VS_in input)
{
VS_out output;
output.Position = mul(combinedMat, input.Position);
float3 Vertex = mul(worldMat, input.Position).xyz;
float3 Normal = mul(normalMat, input.Normal);
output.TexCoord0.xy = input.TexCoord;
output.TexCoord1.xy = input.TexCoord1;
output.Color = input.Prelight;
output.Color.rgb *= ambient.rgb;
output.Color.rgb += emissive.rgb;
output.Color = clamp(output.Color, 0.0, 1.0);
output.Color.a *= matCol.a;
output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0);
return output;
}

View File

@ -0,0 +1,55 @@
static unsigned char leedsBuilding_VS_cso[] = {
0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff,
0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00,
0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00,
0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00,
0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69,
0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62,
0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00,
0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67,
0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00,
0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f,
0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53,
0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d,
0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39,
0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05,
0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
0x0a, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02,
0x00, 0x00, 0x07, 0x80, 0x2a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
0x00, 0x00, 0x07, 0x80, 0x03, 0x00, 0xe4, 0x90, 0x00, 0x00, 0xe4, 0x80,
0x29, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80,
0x03, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x03,
0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x55, 0xa0,
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80,
0x0c, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0xd0,
0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90,
0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80,
0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80,
0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0,
0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03,
0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0e, 0x00, 0x55, 0xa1,
0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80,
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80,
0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80,
0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03,
0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x55, 0xa0,
0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90,
0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90,
0xff, 0xff, 0x00, 0x00
};

View File

@ -0,0 +1,28 @@
const char *leedsBuilding_vert_src =
"uniform vec4 u_amb;\n"
"uniform vec4 u_emiss;\n"
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
"VSOUT vec4 v_color;\n"
"VSOUT vec2 v_tex0;\n"
"VSOUT float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" vec3 Normal = mat3(u_world) * in_normal;\n"
" v_tex0 = in_tex0;\n"
" v_color = in_color;\n"
" v_color.rgb *= u_amb.rgb;\n"
" v_color.rgb += u_emiss.rgb;\n"
" v_color = clamp(v_color, 0.0, 1.0);\n"
" v_color.a *= u_matColor.a;\n"
" v_fog = DoFog(gl_Position.w);\n"
"}\n"
;

View File

@ -0,0 +1,18 @@
uniform sampler2D tex0;
uniform vec4 u_colorscale;
FSIN vec4 v_color;
FSIN vec2 v_tex0;
FSIN float v_fog;
void
main(void)
{
vec4 color;
color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale;
color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);
DoAlphaTest(color.a);
FRAGCOLOR(color);
}

Binary file not shown.

View File

@ -0,0 +1,19 @@
struct VS_out {
float4 Position : POSITION;
float3 TexCoord0 : TEXCOORD0;
float4 Color : COLOR0;
};
sampler2D tex0 : register(s0);
float4 fogColor : register(c0);
float4 colorscale : register(c1);
float4 main(VS_out input) : COLOR
{
float4 color = input.Color;
color *= tex2D(tex0, input.TexCoord0.xy);
color *= colorscale;
color.rgb = lerp(fogColor.rgb, color.rgb, input.TexCoord0.z);
return color;
}

View File

@ -0,0 +1,33 @@
static unsigned char scale_PS_cso[] = {
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x34, 0x00, 0x43, 0x54, 0x41, 0x42,
0x1c, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
0x01, 0x00, 0x06, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x84, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x63, 0x61,
0x6c, 0x65, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x67, 0x43,
0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x30, 0x00, 0xab, 0xab,
0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d,
0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29,
0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e,
0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90,
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02,
0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0,
0x01, 0x00, 0xe4, 0x81, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x08, 0x80,
0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04,
0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80,
0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80,
0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
};

View File

@ -0,0 +1,20 @@
const char *scale_frag_src =
"uniform sampler2D tex0;\n"
"uniform vec4 u_colorscale;\n"
"FSIN vec4 v_color;\n"
"FSIN vec2 v_tex0;\n"
"FSIN float v_fog;\n"
"void\n"
"main(void)\n"
"{\n"
" vec4 color;\n"
" color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale;\n"
" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n"
" DoAlphaTest(color.a);\n"
" FRAGCOLOR(color);\n"
"}\n"
;

View File

@ -136,6 +136,61 @@ float CTimeCycle::m_fShadowSideY[16];
float CTimeCycle::m_fShadowDisplacementX[16];
float CTimeCycle::m_fShadowDisplacementY[16];
static float tmp_nAmbientRed[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
static float tmp_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
static float tmp_nDirectionalRed[NUMHOURS][NUMWEATHERS];
static float tmp_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nSkyTopRed[NUMHOURS][NUMWEATHERS];
static float tmp_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
static float tmp_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nSunCoreRed[NUMHOURS][NUMWEATHERS];
static float tmp_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
static float tmp_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
static float tmp_fSunSize[NUMHOURS][NUMWEATHERS];
static float tmp_fSpriteSize[NUMHOURS][NUMWEATHERS];
static float tmp_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
static float tmp_nShadowStrength[NUMHOURS][NUMWEATHERS];
static float tmp_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
static float tmp_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
static float tmp_fFogStart[NUMHOURS][NUMWEATHERS];
static float tmp_fFarClip[NUMHOURS][NUMWEATHERS];
static float tmp_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
static float tmp_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
static float tmp_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
static float tmp_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
static float tmp_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
static float tmp_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
static float tmp_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
static float tmp_fBlurRed[NUMHOURS][NUMWEATHERS];
static float tmp_fBlurGreen[NUMHOURS][NUMWEATHERS];
static float tmp_fBlurBlue[NUMHOURS][NUMWEATHERS];
static float tmp_fWaterRed[NUMHOURS][NUMWEATHERS];
static float tmp_fWaterGreen[NUMHOURS][NUMWEATHERS];
static float tmp_fWaterBlue[NUMHOURS][NUMWEATHERS];
static float tmp_fWaterAlpha[NUMHOURS][NUMWEATHERS];
void
CTimeCycle::Initialise(void)
{
@ -172,8 +227,9 @@ CTimeCycle::Initialise(void)
for(w = 0; w < NUMWEATHERS; w++)
for(h = 0; h < NUMHOURS; h++){
li = 0;
while(work_buff[bi] == '/'){
while(work_buff[bi] != '\n')
while(work_buff[bi] == '/' || work_buff[bi] == '\n' ||
work_buff[bi] == '\0' || work_buff[bi] == '\r'){
while(work_buff[bi] != '\n' && work_buff[bi] != '\0' && work_buff[bi] != '\r')
bi++;
bi++;
}
@ -208,65 +264,180 @@ CTimeCycle::Initialise(void)
&blurR, &blurG, &blurB,
&waterR, &waterG, &waterB, &waterA);
m_nAmbientRed[h][w] = ambR;
m_nAmbientGreen[h][w] = ambG;
m_nAmbientBlue[h][w] = ambB;
m_nAmbientRed_Obj[h][w] = ambobjR;
m_nAmbientGreen_Obj[h][w] = ambobjG;
m_nAmbientBlue_Obj[h][w] = ambobjB;
m_nAmbientRed_Bl[h][w] = ambblR;
m_nAmbientGreen_Bl[h][w] = ambblG;
m_nAmbientBlue_Bl[h][w] = ambblB;
m_nAmbientRed_Obj_Bl[h][w] = ambobjblR;
m_nAmbientGreen_Obj_Bl[h][w] = ambobjblG;
m_nAmbientBlue_Obj_Bl[h][w] = ambobjblB;
m_nDirectionalRed[h][w] = dirR;
m_nDirectionalGreen[h][w] = dirG;
m_nDirectionalBlue[h][w] = dirB;
m_nSkyTopRed[h][w] = skyTopR;
m_nSkyTopGreen[h][w] = skyTopG;
m_nSkyTopBlue[h][w] = skyTopB;
m_nSkyBottomRed[h][w] = skyBotR;
m_nSkyBottomGreen[h][w] = skyBotG;
m_nSkyBottomBlue[h][w] = skyBotB;
m_nSunCoreRed[h][w] = sunCoreR;
m_nSunCoreGreen[h][w] = sunCoreG;
m_nSunCoreBlue[h][w] = sunCoreB;
m_nSunCoronaRed[h][w] = sunCoronaR;
m_nSunCoronaGreen[h][w] = sunCoronaG;
m_nSunCoronaBlue[h][w] = sunCoronaB;
m_fSunSize[h][w] = sunSz * 10.0f;
m_fSpriteSize[h][w] = sprSz * 10.0f;
m_fSpriteBrightness[h][w] = sprBght * 10.0f;
m_nShadowStrength[h][w] = shad;
m_nLightShadowStrength[h][w] = lightShad;
m_nPoleShadowStrength[h][w] = poleShad;
m_fFarClip[h][w] = farClp;
m_fFogStart[h][w] = fogSt;
m_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f;
m_nLowCloudsRed[h][w] = cloudR;
m_nLowCloudsGreen[h][w] = cloudG;
m_nLowCloudsBlue[h][w] = cloudB;
m_nFluffyCloudsTopRed[h][w] = fluffyTopR;
m_nFluffyCloudsTopGreen[h][w] = fluffyTopG;
m_nFluffyCloudsTopBlue[h][w] = fluffyTopB;
m_nFluffyCloudsBottomRed[h][w] = fluffyBotR;
m_nFluffyCloudsBottomGreen[h][w] = fluffyBotG;
m_nFluffyCloudsBottomBlue[h][w] = fluffyBotB;
m_fBlurRed[h][w] = blurR;
m_fBlurGreen[h][w] = blurG;
m_fBlurBlue[h][w] = blurB;
m_fWaterRed[h][w] = waterR;
m_fWaterGreen[h][w] = waterG;
m_fWaterBlue[h][w] = waterB;
m_fWaterAlpha[h][w] = waterA;
tmp_nAmbientRed[h][w] = ambR;
tmp_nAmbientGreen[h][w] = ambG;
tmp_nAmbientBlue[h][w] = ambB;
tmp_nAmbientRed_Obj[h][w] = ambobjR;
tmp_nAmbientGreen_Obj[h][w] = ambobjG;
tmp_nAmbientBlue_Obj[h][w] = ambobjB;
tmp_nAmbientRed_Bl[h][w] = ambblR;
tmp_nAmbientGreen_Bl[h][w] = ambblG;
tmp_nAmbientBlue_Bl[h][w] = ambblB;
tmp_nAmbientRed_Obj_Bl[h][w] = ambobjblR;
tmp_nAmbientGreen_Obj_Bl[h][w] = ambobjblG;
tmp_nAmbientBlue_Obj_Bl[h][w] = ambobjblB;
tmp_nDirectionalRed[h][w] = dirR;
tmp_nDirectionalGreen[h][w] = dirG;
tmp_nDirectionalBlue[h][w] = dirB;
tmp_nSkyTopRed[h][w] = skyTopR;
tmp_nSkyTopGreen[h][w] = skyTopG;
tmp_nSkyTopBlue[h][w] = skyTopB;
tmp_nSkyBottomRed[h][w] = skyBotR;
tmp_nSkyBottomGreen[h][w] = skyBotG;
tmp_nSkyBottomBlue[h][w] = skyBotB;
tmp_nSunCoreRed[h][w] = sunCoreR;
tmp_nSunCoreGreen[h][w] = sunCoreG;
tmp_nSunCoreBlue[h][w] = sunCoreB;
tmp_nSunCoronaRed[h][w] = sunCoronaR;
tmp_nSunCoronaGreen[h][w] = sunCoronaG;
tmp_nSunCoronaBlue[h][w] = sunCoronaB;
if(sunSz == -1)
tmp_fSunSize[h][w] = -1;
else
tmp_fSunSize[h][w] = sunSz * 10.0f;
if(sprSz == -1)
tmp_fSpriteSize[h][w] = -1;
else
tmp_fSpriteSize[h][w] = sprSz * 10.0f;
if(sprBght == -1)
tmp_fSpriteBrightness[h][w] = -1;
else
tmp_fSpriteBrightness[h][w] = sprBght * 10.0f;
tmp_nShadowStrength[h][w] = shad;
tmp_nLightShadowStrength[h][w] = lightShad;
tmp_nPoleShadowStrength[h][w] = poleShad;
tmp_fFarClip[h][w] = farClp;
tmp_fFogStart[h][w] = fogSt;
if(lightGnd == -1)
tmp_fLightsOnGroundBrightness[h][w] = -1;
else
tmp_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f;
tmp_nLowCloudsRed[h][w] = cloudR;
tmp_nLowCloudsGreen[h][w] = cloudG;
tmp_nLowCloudsBlue[h][w] = cloudB;
tmp_nFluffyCloudsTopRed[h][w] = fluffyTopR;
tmp_nFluffyCloudsTopGreen[h][w] = fluffyTopG;
tmp_nFluffyCloudsTopBlue[h][w] = fluffyTopB;
tmp_nFluffyCloudsBottomRed[h][w] = fluffyBotR;
tmp_nFluffyCloudsBottomGreen[h][w] = fluffyBotG;
tmp_nFluffyCloudsBottomBlue[h][w] = fluffyBotB;
tmp_fBlurRed[h][w] = blurR;
tmp_fBlurGreen[h][w] = blurG;
tmp_fBlurBlue[h][w] = blurB;
tmp_fWaterRed[h][w] = waterR;
tmp_fWaterGreen[h][w] = waterG;
tmp_fWaterBlue[h][w] = waterB;
tmp_fWaterAlpha[h][w] = waterA;
}
UpdateArrays();
m_FogReduction = 0;
debug("CTimeCycle ready\n");
}
template<typename T> void
FillGaps(T (*out)[NUMWEATHERS], float (*in)[NUMWEATHERS])
{
int w;
for(w = 0; w < NUMWEATHERS; w++){
for(int h = 0; h < NUMHOURS; h++)
out[h][w] = in[h][w];
#define NEXT(h) (((h)+1)%NUMHOURS)
#define PREV(h) (((h)+NUMHOURS-1)%NUMHOURS)
int hend, h1, h2;
for(hend = 0; hend < NUMHOURS; hend++)
if(in[hend][w] != -1.0f)
goto foundstart;
return; // this should never happen
foundstart:
// Found the start of a block of filled in entries
for(h1 = NEXT(hend); h1 != hend; h1 = h2){
// Skip filled in entries
for(; h1 != hend; h1 = NEXT(h1))
if(in[h1][w] == -1.0f)
goto foundfirst;
break; // all filled in already
foundfirst:
// h1 is now the first -1 after n filled in values
for(h2 = NEXT(h1); ; h2 = NEXT(h2))
if(in[h2][w] != -1.0f)
goto foundlast;
break;
foundlast:
// h2 is now the first entry after a row of -1s
h1 = PREV(h1); // make h1 the first before a row of -1s
int n = (h2-h1 + NUMHOURS) % NUMHOURS;
if(n == 0) n = NUMHOURS; // can't happen
float step = (in[h2][w] - in[h1][w])/n;
for(int i = 1; i < n; i++){
float f = (float)i/n;
out[(h1+i)%NUMHOURS][w] = in[h2][w]*f + in[h1][w]*(1.0f-f);
}
}
}
}
void
CTimeCycle::UpdateArrays(void)
{
FillGaps(m_nAmbientRed, tmp_nAmbientRed);
FillGaps(m_nAmbientGreen, tmp_nAmbientGreen);
FillGaps(m_nAmbientBlue, tmp_nAmbientBlue);
FillGaps(m_nAmbientRed_Obj, tmp_nAmbientRed_Obj);
FillGaps(m_nAmbientGreen_Obj, tmp_nAmbientGreen_Obj);
FillGaps(m_nAmbientBlue_Obj, tmp_nAmbientBlue_Obj);
FillGaps(m_nAmbientRed_Bl, tmp_nAmbientRed_Bl);
FillGaps(m_nAmbientGreen_Bl, tmp_nAmbientGreen_Bl);
FillGaps(m_nAmbientBlue_Bl, tmp_nAmbientBlue_Bl);
FillGaps(m_nAmbientRed_Obj_Bl, tmp_nAmbientRed_Obj_Bl);
FillGaps(m_nAmbientGreen_Obj_Bl, tmp_nAmbientGreen_Obj_Bl);
FillGaps(m_nAmbientBlue_Obj_Bl, tmp_nAmbientBlue_Obj_Bl);
FillGaps(m_nDirectionalRed, tmp_nDirectionalRed);
FillGaps(m_nDirectionalGreen, tmp_nDirectionalGreen);
FillGaps(m_nDirectionalBlue, tmp_nDirectionalBlue);
FillGaps(m_nSkyTopRed, tmp_nSkyTopRed);
FillGaps(m_nSkyTopGreen, tmp_nSkyTopGreen);
FillGaps(m_nSkyTopBlue, tmp_nSkyTopBlue);
FillGaps(m_nSkyBottomRed, tmp_nSkyBottomRed);
FillGaps(m_nSkyBottomGreen, tmp_nSkyBottomGreen);
FillGaps(m_nSkyBottomBlue, tmp_nSkyBottomBlue);
FillGaps(m_nSunCoreRed, tmp_nSunCoreRed);
FillGaps(m_nSunCoreGreen, tmp_nSunCoreGreen);
FillGaps(m_nSunCoreBlue, tmp_nSunCoreBlue);
FillGaps(m_nSunCoronaRed, tmp_nSunCoronaRed);
FillGaps(m_nSunCoronaGreen, tmp_nSunCoronaGreen);
FillGaps(m_nSunCoronaBlue, tmp_nSunCoronaBlue);
FillGaps(m_fSunSize, tmp_fSunSize);
FillGaps(m_fSpriteSize, tmp_fSpriteSize);
FillGaps(m_fSpriteBrightness, tmp_fSpriteBrightness);
FillGaps(m_nShadowStrength, tmp_nShadowStrength);
FillGaps(m_nLightShadowStrength, tmp_nLightShadowStrength);
FillGaps(m_nPoleShadowStrength, tmp_nPoleShadowStrength);
FillGaps(m_fFogStart, tmp_fFogStart);
FillGaps(m_fFarClip, tmp_fFarClip);
FillGaps(m_fLightsOnGroundBrightness, tmp_fLightsOnGroundBrightness);
FillGaps(m_nLowCloudsRed, tmp_nLowCloudsRed);
FillGaps(m_nLowCloudsGreen, tmp_nLowCloudsGreen);
FillGaps(m_nLowCloudsBlue, tmp_nLowCloudsBlue);
FillGaps(m_nFluffyCloudsTopRed, tmp_nFluffyCloudsTopRed);
FillGaps(m_nFluffyCloudsTopGreen, tmp_nFluffyCloudsTopGreen);
FillGaps(m_nFluffyCloudsTopBlue, tmp_nFluffyCloudsTopBlue);
FillGaps(m_nFluffyCloudsBottomRed, tmp_nFluffyCloudsBottomRed);
FillGaps(m_nFluffyCloudsBottomGreen, tmp_nFluffyCloudsBottomGreen);
FillGaps(m_nFluffyCloudsBottomBlue, tmp_nFluffyCloudsBottomBlue);
FillGaps(m_fBlurRed, tmp_fBlurRed);
FillGaps(m_fBlurGreen, tmp_fBlurGreen);
FillGaps(m_fBlurBlue, tmp_fBlurBlue);
FillGaps(m_fWaterRed, tmp_fWaterRed);
FillGaps(m_fWaterGreen, tmp_fWaterGreen);
FillGaps(m_fWaterBlue, tmp_fWaterBlue);
FillGaps(m_fWaterAlpha, tmp_fWaterAlpha);
}
static float interp_c0, interp_c1, interp_c2, interp_c3;
float CTimeCycle::Interpolate(int8 *a, int8 *b)

View File

@ -185,6 +185,7 @@ public:
static int32 GetWaterAlpha(void) { return m_fCurrentWaterAlpha; }
static void Initialise(void);
static void UpdateArrays(void);
static void Update(void);
static float Interpolate(int8 *a, int8 *b);
static float Interpolate(uint8 *a, uint8 *b);

View File

@ -26,12 +26,7 @@ RwRGBAReal DirectionalLightColourForFrame;
RwRGBAReal AmbientLightColour;
RwRGBAReal DirectionalLightColour;
#ifdef EXTENDED_COLOURFILTER
#include "postfx.h"
#define USEBLURCOLORS CPostFX::UseBlurColours()
#else
#define USEBLURCOLORS CMBlur::BlurOn
#endif
#define USEBLURCOLORS true // actually CMBlur::BlurOn, but that's always supposed to be on
void
SetLightsWithTimeOfDayColour(RpWorld *)