mirror of
https://github.com/aap/librw.git
synced 2024-11-28 22:55:42 +00:00
implemented shader default and immediate pipeline for d3d9
This commit is contained in:
parent
4541fe86f7
commit
e012918cd3
@ -27,7 +27,7 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
|||||||
{
|
{
|
||||||
RawMatrix world;
|
RawMatrix world;
|
||||||
|
|
||||||
d3d::lightingCB(atomic);
|
d3d::lightingCB_Fix(atomic);
|
||||||
|
|
||||||
Geometry *geo = atomic->geometry;
|
Geometry *geo = atomic->geometry;
|
||||||
d3d::setRenderState(D3DRS_LIGHTING, !!(geo->flags & rw::Geometry::LIGHT));
|
d3d::setRenderState(D3DRS_LIGHTING, !!(geo->flags & rw::Geometry::LIGHT));
|
||||||
|
@ -32,6 +32,9 @@ static VertexElement _d3ddec_end = {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0};
|
|||||||
static void*
|
static void*
|
||||||
driverOpen(void *o, int32, int32)
|
driverOpen(void *o, int32, int32)
|
||||||
{
|
{
|
||||||
|
#ifdef RW_D3D9
|
||||||
|
createDefaultShaders();
|
||||||
|
#endif
|
||||||
engine->driver[PLATFORM_D3D9]->defaultPipeline = makeDefaultPipeline();
|
engine->driver[PLATFORM_D3D9]->defaultPipeline = makeDefaultPipeline();
|
||||||
|
|
||||||
engine->driver[PLATFORM_D3D9]->rasterNativeOffset = nativeRasterOffset;
|
engine->driver[PLATFORM_D3D9]->rasterNativeOffset = nativeRasterOffset;
|
||||||
@ -48,6 +51,9 @@ driverOpen(void *o, int32, int32)
|
|||||||
static void*
|
static void*
|
||||||
driverClose(void *o, int32, int32)
|
driverClose(void *o, int32, int32)
|
||||||
{
|
{
|
||||||
|
#ifdef RW_D3D9
|
||||||
|
destroyDefaultShaders();
|
||||||
|
#endif
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +644,7 @@ makeDefaultPipeline(void)
|
|||||||
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
||||||
pipe->instanceCB = defaultInstanceCB;
|
pipe->instanceCB = defaultInstanceCB;
|
||||||
pipe->uninstanceCB = defaultUninstanceCB;
|
pipe->uninstanceCB = defaultUninstanceCB;
|
||||||
pipe->renderCB = defaultRenderCB;
|
pipe->renderCB = defaultRenderCB_Shader;
|
||||||
return pipe;
|
return pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ makeMatFXPipeline(void)
|
|||||||
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
||||||
pipe->instanceCB = defaultInstanceCB;
|
pipe->instanceCB = defaultInstanceCB;
|
||||||
pipe->uninstanceCB = defaultUninstanceCB;
|
pipe->uninstanceCB = defaultUninstanceCB;
|
||||||
pipe->renderCB = defaultRenderCB;
|
pipe->renderCB = defaultRenderCB_Shader;
|
||||||
pipe->pluginID = ID_MATFX;
|
pipe->pluginID = ID_MATFX;
|
||||||
pipe->pluginData = 0;
|
pipe->pluginData = 0;
|
||||||
return pipe;
|
return pipe;
|
||||||
|
@ -59,14 +59,14 @@ drawInst_GSemu(d3d9::InstanceDataHeader *header, InstanceData *inst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
defaultRenderCB_Fix(Atomic *atomic, InstanceDataHeader *header)
|
||||||
{
|
{
|
||||||
RawMatrix world;
|
RawMatrix world;
|
||||||
Geometry *geo = atomic->geometry;
|
Geometry *geo = atomic->geometry;
|
||||||
|
|
||||||
int lighting = !!(geo->flags & rw::Geometry::LIGHT);
|
int lighting = !!(geo->flags & rw::Geometry::LIGHT);
|
||||||
if(lighting)
|
if(lighting)
|
||||||
d3d::lightingCB(atomic);
|
d3d::lightingCB_Fix(atomic);
|
||||||
|
|
||||||
d3d::setRenderState(D3DRS_LIGHTING, lighting);
|
d3d::setRenderState(D3DRS_LIGHTING, lighting);
|
||||||
|
|
||||||
@ -125,6 +125,58 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
|||||||
d3d::setTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
d3d::setTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
defaultRenderCB_Shader(Atomic *atomic, InstanceDataHeader *header)
|
||||||
|
{
|
||||||
|
int vsBits;
|
||||||
|
d3ddevice->SetStreamSource(0, (IDirect3DVertexBuffer9*)header->vertexStream[0].vertexBuffer,
|
||||||
|
0, header->vertexStream[0].stride);
|
||||||
|
d3ddevice->SetIndices((IDirect3DIndexBuffer9*)header->indexBuffer);
|
||||||
|
d3ddevice->SetVertexDeclaration((IDirect3DVertexDeclaration9*)header->vertexDeclaration);
|
||||||
|
|
||||||
|
vsBits = lightingCB_Shader(atomic);
|
||||||
|
uploadMatrices(atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
|
// Pick a shader
|
||||||
|
if((vsBits & VSLIGHT_MASK) == 0)
|
||||||
|
setVertexShader(default_amb_VS);
|
||||||
|
else if((vsBits & VSLIGHT_MASK) == VSLIGHT_DIRECT)
|
||||||
|
setVertexShader(default_amb_dir_VS);
|
||||||
|
else
|
||||||
|
setVertexShader(default_all_VS);
|
||||||
|
|
||||||
|
float surfProps[4];
|
||||||
|
surfProps[3] = atomic->geometry->flags&Geometry::PRELIT ? 1.0f : 0.0f;
|
||||||
|
|
||||||
|
InstanceData *inst = header->inst;
|
||||||
|
for(uint32 i = 0; i < header->numMeshes; i++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||||
|
|
||||||
|
rw::RGBAf col;
|
||||||
|
convColor(&col, &inst->material->color);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_matColor, (float*)&col, 1);
|
||||||
|
|
||||||
|
surfProps[0] = m->surfaceProps.ambient;
|
||||||
|
surfProps[1] = m->surfaceProps.specular;
|
||||||
|
surfProps[2] = m->surfaceProps.diffuse;
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_surfProps, surfProps, 1);
|
||||||
|
|
||||||
|
if(inst->material->texture){
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
setPixelShader(default_color_tex_PS);
|
||||||
|
}else
|
||||||
|
setPixelShader(default_color_PS);
|
||||||
|
|
||||||
|
drawInst(header, inst);
|
||||||
|
inst++;
|
||||||
|
}
|
||||||
|
setVertexShader(nil);
|
||||||
|
setPixelShader(nil);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ makeSkinPipeline(void)
|
|||||||
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
||||||
pipe->instanceCB = defaultInstanceCB;
|
pipe->instanceCB = defaultInstanceCB;
|
||||||
pipe->uninstanceCB = defaultUninstanceCB;
|
pipe->uninstanceCB = defaultUninstanceCB;
|
||||||
pipe->renderCB = defaultRenderCB;
|
pipe->renderCB = defaultRenderCB_Shader;
|
||||||
pipe->pluginID = ID_SKIN;
|
pipe->pluginID = ID_SKIN;
|
||||||
pipe->pluginData = 1;
|
pipe->pluginData = 1;
|
||||||
return pipe;
|
return pipe;
|
||||||
|
@ -605,6 +605,21 @@ createPixelShader(void *csosrc)
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
destroyVertexShader(void *shader)
|
||||||
|
{
|
||||||
|
((IDirect3DVertexShader9*)shader)->Release();
|
||||||
|
d3d9Globals.numVertexShaders--;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
destroyPixelShader(void *shader)
|
||||||
|
{
|
||||||
|
((IDirect3DPixelShader9*)shader)->Release();
|
||||||
|
d3d9Globals.numPixelShaders--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Camera
|
// Camera
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#define WITH_D3D
|
#define WITH_D3D
|
||||||
#include "../rwbase.h"
|
#include "../rwbase.h"
|
||||||
#include "../rwplg.h"
|
#include "../rwplg.h"
|
||||||
|
#include "../rwrender.h"
|
||||||
#include "../rwpipeline.h"
|
#include "../rwpipeline.h"
|
||||||
#include "../rwobjects.h"
|
#include "../rwobjects.h"
|
||||||
#include "../rwengine.h"
|
#include "../rwengine.h"
|
||||||
@ -106,12 +107,11 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices)
|
|||||||
|
|
||||||
d3ddevice->SetStreamSource(0, im2dvertbuf, 0, sizeof(Im2DVertex));
|
d3ddevice->SetStreamSource(0, im2dvertbuf, 0, sizeof(Im2DVertex));
|
||||||
d3ddevice->SetVertexDeclaration(im2ddecl);
|
d3ddevice->SetVertexDeclaration(im2ddecl);
|
||||||
setTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
||||||
setTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
if(engine->device.getRenderState(TEXTURERASTER))
|
||||||
setTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
|
setPixelShader(default_color_tex_PS);
|
||||||
setTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
else
|
||||||
setTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
setPixelShader(default_color_PS);
|
||||||
setTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
|
|
||||||
|
|
||||||
d3d::flushCache();
|
d3d::flushCache();
|
||||||
|
|
||||||
@ -137,6 +137,8 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
d3ddevice->DrawPrimitive((D3DPRIMITIVETYPE)primTypeMap[primType], 0, primCount);
|
d3ddevice->DrawPrimitive((D3DPRIMITIVETYPE)primTypeMap[primType], 0, primCount);
|
||||||
|
|
||||||
|
setPixelShader(nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -159,12 +161,11 @@ im2DRenderIndexedPrimitive(PrimitiveType primType,
|
|||||||
d3ddevice->SetStreamSource(0, im2dvertbuf, 0, sizeof(Im2DVertex));
|
d3ddevice->SetStreamSource(0, im2dvertbuf, 0, sizeof(Im2DVertex));
|
||||||
d3ddevice->SetIndices(im2dindbuf);
|
d3ddevice->SetIndices(im2dindbuf);
|
||||||
d3ddevice->SetVertexDeclaration(im2ddecl);
|
d3ddevice->SetVertexDeclaration(im2ddecl);
|
||||||
setTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
||||||
setTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
if(engine->device.getRenderState(TEXTURERASTER))
|
||||||
setTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
|
setPixelShader(default_color_tex_PS);
|
||||||
setTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
else
|
||||||
setTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
setPixelShader(default_color_PS);
|
||||||
setTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
|
|
||||||
|
|
||||||
d3d::flushCache();
|
d3d::flushCache();
|
||||||
|
|
||||||
@ -192,6 +193,8 @@ im2DRenderIndexedPrimitive(PrimitiveType primType,
|
|||||||
d3ddevice->DrawIndexedPrimitive((D3DPRIMITIVETYPE)primTypeMap[primType], 0,
|
d3ddevice->DrawIndexedPrimitive((D3DPRIMITIVETYPE)primTypeMap[primType], 0,
|
||||||
0, numVertices,
|
0, numVertices,
|
||||||
0, primCount);
|
0, primCount);
|
||||||
|
|
||||||
|
setPixelShader(nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -242,16 +245,10 @@ closeIm3D(void)
|
|||||||
void
|
void
|
||||||
im3DTransform(void *vertices, int32 numVertices, Matrix *world)
|
im3DTransform(void *vertices, int32 numVertices, Matrix *world)
|
||||||
{
|
{
|
||||||
RawMatrix d3dworld;
|
if(world == nil)
|
||||||
d3d::setRenderState(D3DRS_LIGHTING, 0);
|
uploadMatrices();
|
||||||
|
else
|
||||||
if(world == nil){
|
uploadMatrices(world);
|
||||||
Matrix ident;
|
|
||||||
ident.setIdentity();
|
|
||||||
convMatrix(&d3dworld, &ident);
|
|
||||||
}else
|
|
||||||
convMatrix(&d3dworld, world);
|
|
||||||
d3ddevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)&d3dworld);
|
|
||||||
|
|
||||||
uint8 *lockedvertices = lockVertices(im3dvertbuf, 0, numVertices*sizeof(Im3DVertex), D3DLOCK_DISCARD);
|
uint8 *lockedvertices = lockVertices(im3dvertbuf, 0, numVertices*sizeof(Im3DVertex), D3DLOCK_DISCARD);
|
||||||
memcpy(lockedvertices, vertices, numVertices*sizeof(Im3DVertex));
|
memcpy(lockedvertices, vertices, numVertices*sizeof(Im3DVertex));
|
||||||
@ -271,12 +268,12 @@ im3DRenderIndexed(PrimitiveType primType, void *indices, int32 numIndices)
|
|||||||
unlockIndices(im3dindbuf);
|
unlockIndices(im3dindbuf);
|
||||||
|
|
||||||
d3ddevice->SetIndices(im3dindbuf);
|
d3ddevice->SetIndices(im3dindbuf);
|
||||||
setTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
|
||||||
setTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
if(engine->device.getRenderState(TEXTURERASTER))
|
||||||
setTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
|
setPixelShader(default_color_tex_PS);
|
||||||
setTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
else
|
||||||
setTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
setPixelShader(default_color_PS);
|
||||||
setTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
|
|
||||||
d3d::flushCache();
|
d3d::flushCache();
|
||||||
|
|
||||||
uint32 primCount = 0;
|
uint32 primCount = 0;
|
||||||
@ -304,6 +301,8 @@ im3DRenderIndexed(PrimitiveType primType, void *indices, int32 numIndices)
|
|||||||
d3ddevice->DrawIndexedPrimitive((D3DPRIMITIVETYPE)primTypeMap[primType], 0,
|
d3ddevice->DrawIndexedPrimitive((D3DPRIMITIVETYPE)primTypeMap[primType], 0,
|
||||||
0, num3DVertices,
|
0, num3DVertices,
|
||||||
0, primCount);
|
0, primCount);
|
||||||
|
|
||||||
|
setPixelShader(nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -19,8 +19,71 @@ IDirect3DDevice9 *d3ddevice = nil;
|
|||||||
|
|
||||||
#define MAX_LIGHTS 8
|
#define MAX_LIGHTS 8
|
||||||
|
|
||||||
|
|
||||||
|
#define VS_NAME g_vs20_main
|
||||||
|
#define PS_NAME g_ps20_main
|
||||||
|
void *default_amb_VS;
|
||||||
|
void *default_amb_dir_VS;
|
||||||
|
void *default_all_VS;
|
||||||
|
void *default_color_PS;
|
||||||
|
void *default_color_tex_PS;
|
||||||
|
|
||||||
void
|
void
|
||||||
lightingCB(Atomic *atomic)
|
createDefaultShaders(void)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static
|
||||||
|
#include "shaders/default_amb_VS.h"
|
||||||
|
default_amb_VS = createVertexShader((void*)VS_NAME);
|
||||||
|
assert(default_amb_VS);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
static
|
||||||
|
#include "shaders/default_amb_dir_VS.h"
|
||||||
|
default_amb_dir_VS = createVertexShader((void*)VS_NAME);
|
||||||
|
assert(default_amb_dir_VS);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
static
|
||||||
|
#include "shaders/default_all_VS.h"
|
||||||
|
default_all_VS = createVertexShader((void*)VS_NAME);
|
||||||
|
assert(default_all_VS);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
static
|
||||||
|
#include "shaders/default_color_PS.h"
|
||||||
|
default_color_PS = createPixelShader((void*)PS_NAME);
|
||||||
|
assert(default_color_PS);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
static
|
||||||
|
#include "shaders/default_color_tex_PS.h"
|
||||||
|
default_color_tex_PS = createPixelShader((void*)PS_NAME);
|
||||||
|
assert(default_color_tex_PS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
destroyDefaultShaders(void)
|
||||||
|
{
|
||||||
|
destroyVertexShader(default_amb_VS);
|
||||||
|
default_amb_VS = nil;
|
||||||
|
destroyVertexShader(default_amb_dir_VS);
|
||||||
|
default_amb_dir_VS = nil;
|
||||||
|
destroyVertexShader(default_all_VS);
|
||||||
|
default_all_VS = nil;
|
||||||
|
|
||||||
|
destroyPixelShader(default_color_PS);
|
||||||
|
default_color_PS = nil;
|
||||||
|
destroyPixelShader(default_color_tex_PS);
|
||||||
|
default_color_tex_PS = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
lightingCB_Fix(Atomic *atomic)
|
||||||
{
|
{
|
||||||
WorldLights lightData;
|
WorldLights lightData;
|
||||||
Light *directionals[8];
|
Light *directionals[8];
|
||||||
@ -127,6 +190,162 @@ lightingCB(Atomic *atomic)
|
|||||||
d3ddevice->LightEnable(n, FALSE);
|
d3ddevice->LightEnable(n, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct LightVS
|
||||||
|
{
|
||||||
|
V3d color; float param0;
|
||||||
|
V3d position; float param1;
|
||||||
|
V3d direction; float param2;
|
||||||
|
};
|
||||||
|
|
||||||
|
int32
|
||||||
|
uploadLights(WorldLights *lightData)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int bits = 0;
|
||||||
|
int32 numLights[4*3];
|
||||||
|
float32 firstLight[4];
|
||||||
|
firstLight[0] = 0; // directional
|
||||||
|
firstLight[1] = 0; // point
|
||||||
|
firstLight[2] = 0; // spot
|
||||||
|
firstLight[3] = 0;
|
||||||
|
|
||||||
|
if(lightData->numAmbients)
|
||||||
|
bits |= VSLIGHT_AMBIENT;
|
||||||
|
|
||||||
|
LightVS directionals[8];
|
||||||
|
LightVS points[8];
|
||||||
|
LightVS spots[8];
|
||||||
|
for(i = 0; i < lightData->numDirectionals; i++){
|
||||||
|
Light *l = lightData->directionals[i];
|
||||||
|
directionals[i].color.x = l->color.red;
|
||||||
|
directionals[i].color.y = l->color.green;
|
||||||
|
directionals[i].color.z = l->color.blue;
|
||||||
|
directionals[i].direction = l->getFrame()->getLTM()->at;
|
||||||
|
bits |= VSLIGHT_DIRECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
int np = 0;
|
||||||
|
int ns = 0;
|
||||||
|
for(i = 0; i < lightData->numLocals; i++){
|
||||||
|
Light *l = lightData->locals[i];
|
||||||
|
|
||||||
|
switch(l->getType()){
|
||||||
|
case Light::POINT:
|
||||||
|
points[np].color.x = l->color.red;
|
||||||
|
points[np].color.y = l->color.green;
|
||||||
|
points[np].color.z = l->color.blue;
|
||||||
|
points[np].param0 = l->radius;
|
||||||
|
points[np].position = l->getFrame()->getLTM()->pos;
|
||||||
|
np++;
|
||||||
|
bits |= VSLIGHT_POINT;
|
||||||
|
break;
|
||||||
|
case Light::SPOT:
|
||||||
|
case Light::SOFTSPOT:
|
||||||
|
spots[ns].color.x = l->color.red;
|
||||||
|
spots[ns].color.y = l->color.green;
|
||||||
|
spots[ns].color.z = l->color.blue;
|
||||||
|
spots[ns].param0 = l->radius;
|
||||||
|
spots[ns].position = l->getFrame()->getLTM()->pos;
|
||||||
|
spots[ns].direction = l->getFrame()->getLTM()->at;
|
||||||
|
spots[ns].param1 = l->minusCosAngle;
|
||||||
|
// lower bound of falloff
|
||||||
|
if(l->getType() == Light::SOFTSPOT)
|
||||||
|
spots[ns].param2 = 0.0f;
|
||||||
|
else
|
||||||
|
spots[ns].param2 = 1.0f;
|
||||||
|
bits |= VSLIGHT_SPOT;
|
||||||
|
ns++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
firstLight[0] = 0;
|
||||||
|
numLights[0] = lightData->numDirectionals;
|
||||||
|
firstLight[1] = numLights[0] + firstLight[0];
|
||||||
|
numLights[4] = np;
|
||||||
|
firstLight[2] = numLights[4] + firstLight[1];
|
||||||
|
numLights[8] = ns;
|
||||||
|
|
||||||
|
d3ddevice->SetVertexShaderConstantI(VSLOC_numLights, numLights, 3);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_lightOffset, firstLight, 1);
|
||||||
|
|
||||||
|
int32 off = VSLOC_lights;
|
||||||
|
if(numLights[0])
|
||||||
|
d3ddevice->SetVertexShaderConstantF(off, (float*)&directionals, numLights[0]*3);
|
||||||
|
off += numLights[0]*3;
|
||||||
|
|
||||||
|
if(numLights[4])
|
||||||
|
d3ddevice->SetVertexShaderConstantF(off, (float*)&points, numLights[4]*3);
|
||||||
|
off += numLights[4]*3;
|
||||||
|
|
||||||
|
if(numLights[8])
|
||||||
|
d3ddevice->SetVertexShaderConstantF(off, (float*)&spots, numLights[8]*3);
|
||||||
|
|
||||||
|
return bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32
|
||||||
|
lightingCB_Shader(Atomic *atomic)
|
||||||
|
{
|
||||||
|
WorldLights lightData;
|
||||||
|
Light *directionals[8];
|
||||||
|
Light *locals[8];
|
||||||
|
lightData.directionals = directionals;
|
||||||
|
lightData.numDirectionals = 8;
|
||||||
|
lightData.locals = locals;
|
||||||
|
lightData.numLocals = 8;
|
||||||
|
|
||||||
|
int lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
if(lighting){
|
||||||
|
((World*)engine->currentWorld)->enumerateLights(atomic, &lightData);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_ambLight, (float*)&lightData.ambient, 1);
|
||||||
|
return uploadLights(&lightData);
|
||||||
|
}else{
|
||||||
|
static const float zeroF[4];
|
||||||
|
static const int32 zeroI[4];
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_ambLight, zeroF, 1);
|
||||||
|
d3ddevice->SetVertexShaderConstantI(VSLOC_numLights, zeroI, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static RawMatrix identityXform = {
|
||||||
|
{ 1.0f, 0.0f, 0.0f }, 0.0f,
|
||||||
|
{ 0.0f, 1.0f, 0.0f }, 0.0f,
|
||||||
|
{ 0.0f, 0.0f, 1.0f }, 0.0f,
|
||||||
|
{ 0.0f, 0.0f, 0.0f }, 1.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
uploadMatrices(void)
|
||||||
|
{
|
||||||
|
RawMatrix combined;
|
||||||
|
Camera *cam = engine->currentCamera;
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_world, (float*)&identityXform, 4);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_normal, (float*)&identityXform, 4);
|
||||||
|
|
||||||
|
RawMatrix::mult(&combined, &cam->devView, &cam->devProj);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&combined, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
uploadMatrices(Matrix *worldMat)
|
||||||
|
{
|
||||||
|
RawMatrix combined, world, worldview;
|
||||||
|
Camera *cam = engine->currentCamera;
|
||||||
|
convMatrix(&world, worldMat);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_world, (float*)&world, 4);
|
||||||
|
// TODO: inverse transpose
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_normal, (float*)&world, 4);
|
||||||
|
|
||||||
|
RawMatrix::mult(&worldview, &world, &cam->devView);
|
||||||
|
RawMatrix::mult(&combined, &worldview, &cam->devProj);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&combined, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,6 @@ extern IDirect3DDevice9 *d3ddevice;
|
|||||||
void setD3dMaterial(D3DMATERIAL9 *mat9);
|
void setD3dMaterial(D3DMATERIAL9 *mat9);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lightingCB(Atomic *atomic);
|
|
||||||
|
|
||||||
#define COLOR_ARGB(a, r, g, b) ((rw::uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
|
#define COLOR_ARGB(a, r, g, b) ((rw::uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
|
||||||
|
|
||||||
struct Im3DVertex
|
struct Im3DVertex
|
||||||
@ -188,6 +186,57 @@ void setVertexShader(void *vs);
|
|||||||
void setPixelShader(void *ps);
|
void setPixelShader(void *ps);
|
||||||
void *createVertexShader(void *csosrc);
|
void *createVertexShader(void *csosrc);
|
||||||
void *createPixelShader(void *csosrc);
|
void *createPixelShader(void *csosrc);
|
||||||
|
void destroyVertexShader(void *shader);
|
||||||
|
void destroyPixelShader(void *shader);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Vertex shaders and common pipeline stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Standard Vertex shader locations
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
VSLOC_combined = 0,
|
||||||
|
VSLOC_world = 4,
|
||||||
|
VSLOC_normal = 8,
|
||||||
|
VSLOC_matColor = 12,
|
||||||
|
VSLOC_surfProps = 13,
|
||||||
|
VSLOC_ambLight = 14,
|
||||||
|
VSLOC_lightOffset = 15,
|
||||||
|
VSLOC_lights = 16,
|
||||||
|
VSLOC_afterLights = VSLOC_lights + 8*3,
|
||||||
|
|
||||||
|
VSLOC_numLights = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Vertex shader bits
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
// These should be low so they could be used as indices
|
||||||
|
VSLIGHT_DIRECT = 1,
|
||||||
|
VSLIGHT_POINT = 2,
|
||||||
|
VSLIGHT_SPOT = 4,
|
||||||
|
VSLIGHT_MASK = 7, // all the above
|
||||||
|
// less critical
|
||||||
|
VSLIGHT_AMBIENT = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
void lightingCB_Fix(Atomic *atomic);
|
||||||
|
int32 lightingCB_Shader(Atomic *atomic);
|
||||||
|
// for VS
|
||||||
|
void uploadMatrices(void); // no world transform
|
||||||
|
void uploadMatrices(Matrix *worldMat);
|
||||||
|
int32 uploadLights(WorldLights *lightData); // called by lightingCB_Shader
|
||||||
|
|
||||||
|
extern void *default_amb_VS;
|
||||||
|
extern void *default_amb_dir_VS;
|
||||||
|
extern void *default_all_VS;
|
||||||
|
extern void *default_color_PS;
|
||||||
|
extern void *default_color_tex_PS;
|
||||||
|
void createDefaultShaders(void);
|
||||||
|
void destroyDefaultShaders(void);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ void drawInst(d3d9::InstanceDataHeader *header, d3d9::InstanceData *inst);
|
|||||||
// Emulate PS2 GS alpha test FB_ONLY case: failed alpha writes to frame- but not to depth buffer
|
// Emulate PS2 GS alpha test FB_ONLY case: failed alpha writes to frame- but not to depth buffer
|
||||||
void drawInst_GSemu(d3d9::InstanceDataHeader *header, InstanceData *inst);
|
void drawInst_GSemu(d3d9::InstanceDataHeader *header, InstanceData *inst);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void *destroyNativeData(void *object, int32, int32);
|
void *destroyNativeData(void *object, int32, int32);
|
||||||
Stream *readNativeData(Stream *stream, int32 len, void *object, int32, int32);
|
Stream *readNativeData(Stream *stream, int32 len, void *object, int32, int32);
|
||||||
Stream *writeNativeData(Stream *stream, int32 len, void *object, int32, int32);
|
Stream *writeNativeData(Stream *stream, int32 len, void *object, int32, int32);
|
||||||
@ -76,10 +79,12 @@ public:
|
|||||||
|
|
||||||
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
|
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance);
|
||||||
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
|
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
|
||||||
void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header);
|
void defaultRenderCB_Fix(Atomic *atomic, InstanceDataHeader *header);
|
||||||
|
void defaultRenderCB_Shader(Atomic *atomic, InstanceDataHeader *header);
|
||||||
|
|
||||||
ObjPipeline *makeDefaultPipeline(void);
|
ObjPipeline *makeDefaultPipeline(void);
|
||||||
|
|
||||||
|
|
||||||
// Skin plugin
|
// Skin plugin
|
||||||
|
|
||||||
void initSkin(void);
|
void initSkin(void);
|
||||||
|
@ -60,6 +60,7 @@ void removeDynamicVB(IDirect3DVertexBuffer9 **buf);
|
|||||||
|
|
||||||
int findFormatDepth(uint32 format);
|
int findFormatDepth(uint32 format);
|
||||||
void destroyD3D9Raster(Raster *raster);
|
void destroyD3D9Raster(Raster *raster);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Raster *rasterCreate(Raster *raster);
|
Raster *rasterCreate(Raster *raster);
|
||||||
|
74
src/d3d/shaders/defaultVS.hlsl
Normal file
74
src/d3d/shaders/defaultVS.hlsl
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
float4x4 combinedMat : register(c0);
|
||||||
|
float4x4 worldMat : register(c4);
|
||||||
|
float3x3 normalMat : register(c8);
|
||||||
|
float4 matCol : register(c12);
|
||||||
|
float4 surfProps : register(c13);
|
||||||
|
float4 ambientLight : register(c14);
|
||||||
|
|
||||||
|
#define surfAmbient (surfProps.x)
|
||||||
|
#define surfSpecular (surfProps.y)
|
||||||
|
#define surfDiffuse (surfProps.z)
|
||||||
|
#define surfPrelight (surfProps.w)
|
||||||
|
|
||||||
|
#include "lighting.h"
|
||||||
|
|
||||||
|
int numDirLights : register(i0);
|
||||||
|
int numPointLights : register(i1);
|
||||||
|
int numSpotLights : register(i2);
|
||||||
|
int4 firstLight : register(c15);
|
||||||
|
Light lights[8] : register(c16);
|
||||||
|
|
||||||
|
#define firstDirLight (firstLight.x)
|
||||||
|
#define firstPointLight (firstLight.y)
|
||||||
|
#define firstSpotLight (firstLight.z)
|
||||||
|
|
||||||
|
struct VS_in
|
||||||
|
{
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float3 Normal : NORMAL;
|
||||||
|
float2 TexCoord : TEXCOORD0;
|
||||||
|
float4 Prelight : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VS_out {
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float2 TexCoord0 : TEXCOORD0;
|
||||||
|
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 = input.TexCoord;
|
||||||
|
|
||||||
|
output.Color = float4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
if(surfPrelight > 0.0)
|
||||||
|
output.Color = input.Prelight;
|
||||||
|
|
||||||
|
output.Color.rgb += ambientLight.rgb * surfAmbient;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
#ifdef DIRECTIONALS
|
||||||
|
for(i = 0; i < numDirLights; i++)
|
||||||
|
output.Color.xyz += DoDirLight(lights[i+firstDirLight], Normal)*surfDiffuse;
|
||||||
|
#endif
|
||||||
|
#ifdef POINTLIGHTS
|
||||||
|
for(i = 0; i < numPointLights; i++)
|
||||||
|
output.Color.xyz += DoPointLight(lights[i+firstPointLight], Vertex.xyz, Normal)*surfDiffuse;
|
||||||
|
#endif
|
||||||
|
#ifdef SPOTLIGHTS
|
||||||
|
for(i = 0; i < numSpotLights; i++)
|
||||||
|
output.Color.xyz += DoSpotLight(lights[i+firstSpotLight], Vertex.xyz, Normal)*surfDiffuse;
|
||||||
|
#endif
|
||||||
|
// PS2 clamps before material color
|
||||||
|
output.Color = clamp(output.Color, 0.0, 1.0);
|
||||||
|
output.Color *= matCol;
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
485
src/d3d/shaders/default_all_VS.h
Normal file
485
src/d3d/shaders/default_all_VS.h
Normal file
@ -0,0 +1,485 @@
|
|||||||
|
#if 0
|
||||||
|
//
|
||||||
|
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||||
|
//
|
||||||
|
// fxc /T vs_2_0 /DDIRECTIONALS /DPOINTLIGHTS /DSPOTLIGHTS /Fh
|
||||||
|
// default_all_VS.h defaultVS.hlsl
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// float4 ambientLight;
|
||||||
|
// float4x4 combinedMat;
|
||||||
|
// int4 firstLight;
|
||||||
|
//
|
||||||
|
// struct
|
||||||
|
// {
|
||||||
|
// float4 color;
|
||||||
|
// float4 position;
|
||||||
|
// float4 direction;
|
||||||
|
//
|
||||||
|
// } lights[8];
|
||||||
|
//
|
||||||
|
// float4 matCol;
|
||||||
|
// float3x3 normalMat;
|
||||||
|
// int numDirLights;
|
||||||
|
// int numPointLights;
|
||||||
|
// int numSpotLights;
|
||||||
|
// float4 surfProps;
|
||||||
|
// float4x4 worldMat;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Registers:
|
||||||
|
//
|
||||||
|
// Name Reg Size
|
||||||
|
// -------------- ----- ----
|
||||||
|
// numDirLights i0 1
|
||||||
|
// numPointLights i1 1
|
||||||
|
// numSpotLights i2 1
|
||||||
|
// combinedMat c0 4
|
||||||
|
// worldMat c4 4
|
||||||
|
// normalMat c8 3
|
||||||
|
// matCol c12 1
|
||||||
|
// surfProps c13 1
|
||||||
|
// ambientLight c14 1
|
||||||
|
// firstLight c15 1
|
||||||
|
// lights c16 24
|
||||||
|
//
|
||||||
|
|
||||||
|
vs_2_0
|
||||||
|
def c11, 3, 0, 0, 0
|
||||||
|
def c40, 0, -0, -1, 1
|
||||||
|
dcl_position v0
|
||||||
|
dcl_normal v1
|
||||||
|
dcl_texcoord v2
|
||||||
|
dcl_color v3
|
||||||
|
mul r0, v0.y, c1
|
||||||
|
mad r0, c0, v0.x, r0
|
||||||
|
mad r0, c2, v0.z, r0
|
||||||
|
mad oPos, c3, v0.w, r0
|
||||||
|
mul r0.xyz, v0.y, c5
|
||||||
|
mad r0.xyz, c4, v0.x, r0
|
||||||
|
mad r0.xyz, c6, v0.z, r0
|
||||||
|
mad r0.xyz, c7, v0.w, r0
|
||||||
|
mul r1.xyz, v1.y, c9
|
||||||
|
mad r1.xyz, c8, v1.x, r1
|
||||||
|
mad r1.xyz, c10, v1.z, r1
|
||||||
|
mov r2.xw, c40
|
||||||
|
slt r0.w, r2.x, c13.w
|
||||||
|
add r3, v3, c40.yyyz
|
||||||
|
mad r3, r0.w, r3, c40.xxxw
|
||||||
|
mov r2.x, c13.x
|
||||||
|
mad r2.xyz, c14, r2.x, r3
|
||||||
|
mov r4.xyz, r2
|
||||||
|
mov r0.w, c40.x
|
||||||
|
rep i0
|
||||||
|
add r1.w, r0.w, c15.x
|
||||||
|
mul r1.w, r1.w, c11.x
|
||||||
|
mova a0.x, r1.w
|
||||||
|
dp3 r1.w, r1, -c18[a0.x]
|
||||||
|
max r1.w, r1.w, c40.x
|
||||||
|
mul r5.xyz, r1.w, c16[a0.x]
|
||||||
|
mad r4.xyz, r5, c13.z, r4
|
||||||
|
add r0.w, r0.w, c40.w
|
||||||
|
endrep
|
||||||
|
mov r2.xyz, r4
|
||||||
|
mov r0.w, c40.x
|
||||||
|
rep i1
|
||||||
|
add r1.w, r0.w, c15.y
|
||||||
|
mul r1.w, r1.w, c11.x
|
||||||
|
mova a0.x, r1.w
|
||||||
|
add r5.xyz, r0, -c17[a0.x]
|
||||||
|
dp3 r1.w, r5, r5
|
||||||
|
rsq r1.w, r1.w
|
||||||
|
mul r5.xyz, r1.w, r5
|
||||||
|
dp3 r4.w, r1, -r5
|
||||||
|
max r4.w, r4.w, c40.x
|
||||||
|
mul r5.xyz, r4.w, c16[a0.x]
|
||||||
|
rcp r1.w, r1.w
|
||||||
|
rcp r4.w, c16[a0.x].w
|
||||||
|
mad r1.w, r1.w, -r4.w, c40.w
|
||||||
|
max r1.w, r1.w, c40.x
|
||||||
|
mul r5.xyz, r1.w, r5
|
||||||
|
mad r2.xyz, r5, c13.z, r2
|
||||||
|
add r0.w, r0.w, c40.w
|
||||||
|
endrep
|
||||||
|
mov r3.xyz, r2
|
||||||
|
mov r0.w, c40.x
|
||||||
|
rep i2
|
||||||
|
add r1.w, r0.w, c15.z
|
||||||
|
mul r1.w, r1.w, c11.x
|
||||||
|
mova a0.x, r1.w
|
||||||
|
add r4.xyz, r0, -c17[a0.x]
|
||||||
|
dp3 r1.w, r4, r4
|
||||||
|
rsq r1.w, r1.w
|
||||||
|
mul r4.xyz, r1.w, r4
|
||||||
|
dp3 r4.w, r1, -r4
|
||||||
|
dp3 r4.x, r4, c18[a0.x]
|
||||||
|
max r4.y, r4.w, c40.x
|
||||||
|
add r4.x, r4.x, c17[a0.x].w
|
||||||
|
add r4.z, r2.w, c17[a0.x].w
|
||||||
|
rcp r4.z, r4.z
|
||||||
|
mul r4.x, r4.z, r4.x
|
||||||
|
slt r4.z, r4.x, c40.x
|
||||||
|
mad r4.y, r4.z, -r4.y, r4.y
|
||||||
|
max r4.x, r4.x, c18[a0.x].w
|
||||||
|
mul r4.x, r4.x, r4.y
|
||||||
|
mul r4.xyz, r4.x, c16[a0.x]
|
||||||
|
rcp r1.w, r1.w
|
||||||
|
rcp r4.w, c16[a0.x].w
|
||||||
|
mad r1.w, r1.w, -r4.w, c40.w
|
||||||
|
max r1.w, r1.w, c40.x
|
||||||
|
mul r4.xyz, r1.w, r4
|
||||||
|
mad r3.xyz, r4, c13.z, r3
|
||||||
|
add r0.w, r0.w, c40.w
|
||||||
|
endrep
|
||||||
|
max r0, r3, c40.x
|
||||||
|
min r0, r0, c40.w
|
||||||
|
mul oD0, r0, c12
|
||||||
|
mov oT0.xy, v2
|
||||||
|
|
||||||
|
// approximately 93 instruction slots used
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const BYTE g_vs20_main[] =
|
||||||
|
{
|
||||||
|
0, 2, 254, 255, 254, 255,
|
||||||
|
151, 0, 67, 84, 65, 66,
|
||||||
|
28, 0, 0, 0, 39, 2,
|
||||||
|
0, 0, 0, 2, 254, 255,
|
||||||
|
11, 0, 0, 0, 28, 0,
|
||||||
|
0, 0, 0, 1, 0, 0,
|
||||||
|
32, 2, 0, 0, 248, 0,
|
||||||
|
0, 0, 2, 0, 14, 0,
|
||||||
|
1, 0, 58, 0, 8, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
24, 1, 0, 0, 2, 0,
|
||||||
|
0, 0, 4, 0, 2, 0,
|
||||||
|
36, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 52, 1, 0, 0,
|
||||||
|
2, 0, 15, 0, 1, 0,
|
||||||
|
62, 0, 64, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 80, 1,
|
||||||
|
0, 0, 2, 0, 16, 0,
|
||||||
|
24, 0, 66, 0, 156, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
172, 1, 0, 0, 2, 0,
|
||||||
|
12, 0, 1, 0, 50, 0,
|
||||||
|
8, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 179, 1, 0, 0,
|
||||||
|
2, 0, 8, 0, 3, 0,
|
||||||
|
34, 0, 192, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 208, 1,
|
||||||
|
0, 0, 1, 0, 0, 0,
|
||||||
|
1, 0, 2, 0, 224, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
240, 1, 0, 0, 1, 0,
|
||||||
|
1, 0, 1, 0, 6, 0,
|
||||||
|
224, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 255, 1, 0, 0,
|
||||||
|
1, 0, 2, 0, 1, 0,
|
||||||
|
10, 0, 224, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 13, 2,
|
||||||
|
0, 0, 2, 0, 13, 0,
|
||||||
|
1, 0, 54, 0, 8, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
23, 2, 0, 0, 2, 0,
|
||||||
|
4, 0, 4, 0, 18, 0,
|
||||||
|
36, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 97, 109, 98, 105,
|
||||||
|
101, 110, 116, 76, 105, 103,
|
||||||
|
104, 116, 0, 171, 171, 171,
|
||||||
|
1, 0, 3, 0, 1, 0,
|
||||||
|
4, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 99, 111,
|
||||||
|
109, 98, 105, 110, 101, 100,
|
||||||
|
77, 97, 116, 0, 3, 0,
|
||||||
|
3, 0, 4, 0, 4, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 102, 105, 114, 115,
|
||||||
|
116, 76, 105, 103, 104, 116,
|
||||||
|
0, 171, 1, 0, 2, 0,
|
||||||
|
1, 0, 4, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
108, 105, 103, 104, 116, 115,
|
||||||
|
0, 99, 111, 108, 111, 114,
|
||||||
|
0, 171, 171, 171, 1, 0,
|
||||||
|
3, 0, 1, 0, 4, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 112, 111, 115, 105,
|
||||||
|
116, 105, 111, 110, 0, 100,
|
||||||
|
105, 114, 101, 99, 116, 105,
|
||||||
|
111, 110, 0, 171, 87, 1,
|
||||||
|
0, 0, 96, 1, 0, 0,
|
||||||
|
112, 1, 0, 0, 96, 1,
|
||||||
|
0, 0, 121, 1, 0, 0,
|
||||||
|
96, 1, 0, 0, 5, 0,
|
||||||
|
0, 0, 1, 0, 12, 0,
|
||||||
|
8, 0, 3, 0, 132, 1,
|
||||||
|
0, 0, 109, 97, 116, 67,
|
||||||
|
111, 108, 0, 110, 111, 114,
|
||||||
|
109, 97, 108, 77, 97, 116,
|
||||||
|
0, 171, 171, 171, 3, 0,
|
||||||
|
3, 0, 3, 0, 3, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 110, 117, 109, 68,
|
||||||
|
105, 114, 76, 105, 103, 104,
|
||||||
|
116, 115, 0, 171, 171, 171,
|
||||||
|
0, 0, 2, 0, 1, 0,
|
||||||
|
1, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 110, 117,
|
||||||
|
109, 80, 111, 105, 110, 116,
|
||||||
|
76, 105, 103, 104, 116, 115,
|
||||||
|
0, 110, 117, 109, 83, 112,
|
||||||
|
111, 116, 76, 105, 103, 104,
|
||||||
|
116, 115, 0, 115, 117, 114,
|
||||||
|
102, 80, 114, 111, 112, 115,
|
||||||
|
0, 119, 111, 114, 108, 100,
|
||||||
|
77, 97, 116, 0, 118, 115,
|
||||||
|
95, 50, 95, 48, 0, 77,
|
||||||
|
105, 99, 114, 111, 115, 111,
|
||||||
|
102, 116, 32, 40, 82, 41,
|
||||||
|
32, 72, 76, 83, 76, 32,
|
||||||
|
83, 104, 97, 100, 101, 114,
|
||||||
|
32, 67, 111, 109, 112, 105,
|
||||||
|
108, 101, 114, 32, 57, 46,
|
||||||
|
50, 57, 46, 57, 53, 50,
|
||||||
|
46, 51, 49, 49, 49, 0,
|
||||||
|
81, 0, 0, 5, 11, 0,
|
||||||
|
15, 160, 0, 0, 64, 64,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
81, 0, 0, 5, 40, 0,
|
||||||
|
15, 160, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 128, 0, 0,
|
||||||
|
128, 191, 0, 0, 128, 63,
|
||||||
|
31, 0, 0, 2, 0, 0,
|
||||||
|
0, 128, 0, 0, 15, 144,
|
||||||
|
31, 0, 0, 2, 3, 0,
|
||||||
|
0, 128, 1, 0, 15, 144,
|
||||||
|
31, 0, 0, 2, 5, 0,
|
||||||
|
0, 128, 2, 0, 15, 144,
|
||||||
|
31, 0, 0, 2, 10, 0,
|
||||||
|
0, 128, 3, 0, 15, 144,
|
||||||
|
5, 0, 0, 3, 0, 0,
|
||||||
|
15, 128, 0, 0, 85, 144,
|
||||||
|
1, 0, 228, 160, 4, 0,
|
||||||
|
0, 4, 0, 0, 15, 128,
|
||||||
|
0, 0, 228, 160, 0, 0,
|
||||||
|
0, 144, 0, 0, 228, 128,
|
||||||
|
4, 0, 0, 4, 0, 0,
|
||||||
|
15, 128, 2, 0, 228, 160,
|
||||||
|
0, 0, 170, 144, 0, 0,
|
||||||
|
228, 128, 4, 0, 0, 4,
|
||||||
|
0, 0, 15, 192, 3, 0,
|
||||||
|
228, 160, 0, 0, 255, 144,
|
||||||
|
0, 0, 228, 128, 5, 0,
|
||||||
|
0, 3, 0, 0, 7, 128,
|
||||||
|
0, 0, 85, 144, 5, 0,
|
||||||
|
228, 160, 4, 0, 0, 4,
|
||||||
|
0, 0, 7, 128, 4, 0,
|
||||||
|
228, 160, 0, 0, 0, 144,
|
||||||
|
0, 0, 228, 128, 4, 0,
|
||||||
|
0, 4, 0, 0, 7, 128,
|
||||||
|
6, 0, 228, 160, 0, 0,
|
||||||
|
170, 144, 0, 0, 228, 128,
|
||||||
|
4, 0, 0, 4, 0, 0,
|
||||||
|
7, 128, 7, 0, 228, 160,
|
||||||
|
0, 0, 255, 144, 0, 0,
|
||||||
|
228, 128, 5, 0, 0, 3,
|
||||||
|
1, 0, 7, 128, 1, 0,
|
||||||
|
85, 144, 9, 0, 228, 160,
|
||||||
|
4, 0, 0, 4, 1, 0,
|
||||||
|
7, 128, 8, 0, 228, 160,
|
||||||
|
1, 0, 0, 144, 1, 0,
|
||||||
|
228, 128, 4, 0, 0, 4,
|
||||||
|
1, 0, 7, 128, 10, 0,
|
||||||
|
228, 160, 1, 0, 170, 144,
|
||||||
|
1, 0, 228, 128, 1, 0,
|
||||||
|
0, 2, 2, 0, 9, 128,
|
||||||
|
40, 0, 228, 160, 12, 0,
|
||||||
|
0, 3, 0, 0, 8, 128,
|
||||||
|
2, 0, 0, 128, 13, 0,
|
||||||
|
255, 160, 2, 0, 0, 3,
|
||||||
|
3, 0, 15, 128, 3, 0,
|
||||||
|
228, 144, 40, 0, 149, 160,
|
||||||
|
4, 0, 0, 4, 3, 0,
|
||||||
|
15, 128, 0, 0, 255, 128,
|
||||||
|
3, 0, 228, 128, 40, 0,
|
||||||
|
192, 160, 1, 0, 0, 2,
|
||||||
|
2, 0, 1, 128, 13, 0,
|
||||||
|
0, 160, 4, 0, 0, 4,
|
||||||
|
2, 0, 7, 128, 14, 0,
|
||||||
|
228, 160, 2, 0, 0, 128,
|
||||||
|
3, 0, 228, 128, 1, 0,
|
||||||
|
0, 2, 4, 0, 7, 128,
|
||||||
|
2, 0, 228, 128, 1, 0,
|
||||||
|
0, 2, 0, 0, 8, 128,
|
||||||
|
40, 0, 0, 160, 38, 0,
|
||||||
|
0, 1, 0, 0, 228, 240,
|
||||||
|
2, 0, 0, 3, 1, 0,
|
||||||
|
8, 128, 0, 0, 255, 128,
|
||||||
|
15, 0, 0, 160, 5, 0,
|
||||||
|
0, 3, 1, 0, 8, 128,
|
||||||
|
1, 0, 255, 128, 11, 0,
|
||||||
|
0, 160, 46, 0, 0, 2,
|
||||||
|
0, 0, 1, 176, 1, 0,
|
||||||
|
255, 128, 8, 0, 0, 4,
|
||||||
|
1, 0, 8, 128, 1, 0,
|
||||||
|
228, 128, 18, 32, 228, 161,
|
||||||
|
0, 0, 0, 176, 11, 0,
|
||||||
|
0, 3, 1, 0, 8, 128,
|
||||||
|
1, 0, 255, 128, 40, 0,
|
||||||
|
0, 160, 5, 0, 0, 4,
|
||||||
|
5, 0, 7, 128, 1, 0,
|
||||||
|
255, 128, 16, 32, 228, 160,
|
||||||
|
0, 0, 0, 176, 4, 0,
|
||||||
|
0, 4, 4, 0, 7, 128,
|
||||||
|
5, 0, 228, 128, 13, 0,
|
||||||
|
170, 160, 4, 0, 228, 128,
|
||||||
|
2, 0, 0, 3, 0, 0,
|
||||||
|
8, 128, 0, 0, 255, 128,
|
||||||
|
40, 0, 255, 160, 39, 0,
|
||||||
|
0, 0, 1, 0, 0, 2,
|
||||||
|
2, 0, 7, 128, 4, 0,
|
||||||
|
228, 128, 1, 0, 0, 2,
|
||||||
|
0, 0, 8, 128, 40, 0,
|
||||||
|
0, 160, 38, 0, 0, 1,
|
||||||
|
1, 0, 228, 240, 2, 0,
|
||||||
|
0, 3, 1, 0, 8, 128,
|
||||||
|
0, 0, 255, 128, 15, 0,
|
||||||
|
85, 160, 5, 0, 0, 3,
|
||||||
|
1, 0, 8, 128, 1, 0,
|
||||||
|
255, 128, 11, 0, 0, 160,
|
||||||
|
46, 0, 0, 2, 0, 0,
|
||||||
|
1, 176, 1, 0, 255, 128,
|
||||||
|
2, 0, 0, 4, 5, 0,
|
||||||
|
7, 128, 0, 0, 228, 128,
|
||||||
|
17, 32, 228, 161, 0, 0,
|
||||||
|
0, 176, 8, 0, 0, 3,
|
||||||
|
1, 0, 8, 128, 5, 0,
|
||||||
|
228, 128, 5, 0, 228, 128,
|
||||||
|
7, 0, 0, 2, 1, 0,
|
||||||
|
8, 128, 1, 0, 255, 128,
|
||||||
|
5, 0, 0, 3, 5, 0,
|
||||||
|
7, 128, 1, 0, 255, 128,
|
||||||
|
5, 0, 228, 128, 8, 0,
|
||||||
|
0, 3, 4, 0, 8, 128,
|
||||||
|
1, 0, 228, 128, 5, 0,
|
||||||
|
228, 129, 11, 0, 0, 3,
|
||||||
|
4, 0, 8, 128, 4, 0,
|
||||||
|
255, 128, 40, 0, 0, 160,
|
||||||
|
5, 0, 0, 4, 5, 0,
|
||||||
|
7, 128, 4, 0, 255, 128,
|
||||||
|
16, 32, 228, 160, 0, 0,
|
||||||
|
0, 176, 6, 0, 0, 2,
|
||||||
|
1, 0, 8, 128, 1, 0,
|
||||||
|
255, 128, 6, 0, 0, 3,
|
||||||
|
4, 0, 8, 128, 16, 32,
|
||||||
|
255, 160, 0, 0, 0, 176,
|
||||||
|
4, 0, 0, 4, 1, 0,
|
||||||
|
8, 128, 1, 0, 255, 128,
|
||||||
|
4, 0, 255, 129, 40, 0,
|
||||||
|
255, 160, 11, 0, 0, 3,
|
||||||
|
1, 0, 8, 128, 1, 0,
|
||||||
|
255, 128, 40, 0, 0, 160,
|
||||||
|
5, 0, 0, 3, 5, 0,
|
||||||
|
7, 128, 1, 0, 255, 128,
|
||||||
|
5, 0, 228, 128, 4, 0,
|
||||||
|
0, 4, 2, 0, 7, 128,
|
||||||
|
5, 0, 228, 128, 13, 0,
|
||||||
|
170, 160, 2, 0, 228, 128,
|
||||||
|
2, 0, 0, 3, 0, 0,
|
||||||
|
8, 128, 0, 0, 255, 128,
|
||||||
|
40, 0, 255, 160, 39, 0,
|
||||||
|
0, 0, 1, 0, 0, 2,
|
||||||
|
3, 0, 7, 128, 2, 0,
|
||||||
|
228, 128, 1, 0, 0, 2,
|
||||||
|
0, 0, 8, 128, 40, 0,
|
||||||
|
0, 160, 38, 0, 0, 1,
|
||||||
|
2, 0, 228, 240, 2, 0,
|
||||||
|
0, 3, 1, 0, 8, 128,
|
||||||
|
0, 0, 255, 128, 15, 0,
|
||||||
|
170, 160, 5, 0, 0, 3,
|
||||||
|
1, 0, 8, 128, 1, 0,
|
||||||
|
255, 128, 11, 0, 0, 160,
|
||||||
|
46, 0, 0, 2, 0, 0,
|
||||||
|
1, 176, 1, 0, 255, 128,
|
||||||
|
2, 0, 0, 4, 4, 0,
|
||||||
|
7, 128, 0, 0, 228, 128,
|
||||||
|
17, 32, 228, 161, 0, 0,
|
||||||
|
0, 176, 8, 0, 0, 3,
|
||||||
|
1, 0, 8, 128, 4, 0,
|
||||||
|
228, 128, 4, 0, 228, 128,
|
||||||
|
7, 0, 0, 2, 1, 0,
|
||||||
|
8, 128, 1, 0, 255, 128,
|
||||||
|
5, 0, 0, 3, 4, 0,
|
||||||
|
7, 128, 1, 0, 255, 128,
|
||||||
|
4, 0, 228, 128, 8, 0,
|
||||||
|
0, 3, 4, 0, 8, 128,
|
||||||
|
1, 0, 228, 128, 4, 0,
|
||||||
|
228, 129, 8, 0, 0, 4,
|
||||||
|
4, 0, 1, 128, 4, 0,
|
||||||
|
228, 128, 18, 32, 228, 160,
|
||||||
|
0, 0, 0, 176, 11, 0,
|
||||||
|
0, 3, 4, 0, 2, 128,
|
||||||
|
4, 0, 255, 128, 40, 0,
|
||||||
|
0, 160, 2, 0, 0, 4,
|
||||||
|
4, 0, 1, 128, 4, 0,
|
||||||
|
0, 128, 17, 32, 255, 160,
|
||||||
|
0, 0, 0, 176, 2, 0,
|
||||||
|
0, 4, 4, 0, 4, 128,
|
||||||
|
2, 0, 255, 128, 17, 32,
|
||||||
|
255, 160, 0, 0, 0, 176,
|
||||||
|
6, 0, 0, 2, 4, 0,
|
||||||
|
4, 128, 4, 0, 170, 128,
|
||||||
|
5, 0, 0, 3, 4, 0,
|
||||||
|
1, 128, 4, 0, 170, 128,
|
||||||
|
4, 0, 0, 128, 12, 0,
|
||||||
|
0, 3, 4, 0, 4, 128,
|
||||||
|
4, 0, 0, 128, 40, 0,
|
||||||
|
0, 160, 4, 0, 0, 4,
|
||||||
|
4, 0, 2, 128, 4, 0,
|
||||||
|
170, 128, 4, 0, 85, 129,
|
||||||
|
4, 0, 85, 128, 11, 0,
|
||||||
|
0, 4, 4, 0, 1, 128,
|
||||||
|
4, 0, 0, 128, 18, 32,
|
||||||
|
255, 160, 0, 0, 0, 176,
|
||||||
|
5, 0, 0, 3, 4, 0,
|
||||||
|
1, 128, 4, 0, 0, 128,
|
||||||
|
4, 0, 85, 128, 5, 0,
|
||||||
|
0, 4, 4, 0, 7, 128,
|
||||||
|
4, 0, 0, 128, 16, 32,
|
||||||
|
228, 160, 0, 0, 0, 176,
|
||||||
|
6, 0, 0, 2, 1, 0,
|
||||||
|
8, 128, 1, 0, 255, 128,
|
||||||
|
6, 0, 0, 3, 4, 0,
|
||||||
|
8, 128, 16, 32, 255, 160,
|
||||||
|
0, 0, 0, 176, 4, 0,
|
||||||
|
0, 4, 1, 0, 8, 128,
|
||||||
|
1, 0, 255, 128, 4, 0,
|
||||||
|
255, 129, 40, 0, 255, 160,
|
||||||
|
11, 0, 0, 3, 1, 0,
|
||||||
|
8, 128, 1, 0, 255, 128,
|
||||||
|
40, 0, 0, 160, 5, 0,
|
||||||
|
0, 3, 4, 0, 7, 128,
|
||||||
|
1, 0, 255, 128, 4, 0,
|
||||||
|
228, 128, 4, 0, 0, 4,
|
||||||
|
3, 0, 7, 128, 4, 0,
|
||||||
|
228, 128, 13, 0, 170, 160,
|
||||||
|
3, 0, 228, 128, 2, 0,
|
||||||
|
0, 3, 0, 0, 8, 128,
|
||||||
|
0, 0, 255, 128, 40, 0,
|
||||||
|
255, 160, 39, 0, 0, 0,
|
||||||
|
11, 0, 0, 3, 0, 0,
|
||||||
|
15, 128, 3, 0, 228, 128,
|
||||||
|
40, 0, 0, 160, 10, 0,
|
||||||
|
0, 3, 0, 0, 15, 128,
|
||||||
|
0, 0, 228, 128, 40, 0,
|
||||||
|
255, 160, 5, 0, 0, 3,
|
||||||
|
0, 0, 15, 208, 0, 0,
|
||||||
|
228, 128, 12, 0, 228, 160,
|
||||||
|
1, 0, 0, 2, 0, 0,
|
||||||
|
3, 224, 2, 0, 228, 144,
|
||||||
|
255, 255, 0, 0
|
||||||
|
};
|
143
src/d3d/shaders/default_amb_VS.h
Normal file
143
src/d3d/shaders/default_amb_VS.h
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
#if 0
|
||||||
|
//
|
||||||
|
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||||
|
//
|
||||||
|
// fxc /T vs_2_0 /Fh default_amb_VS.h defaultVS.hlsl
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// float4 ambientLight;
|
||||||
|
// float4x4 combinedMat;
|
||||||
|
// float4 matCol;
|
||||||
|
// float4 surfProps;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Registers:
|
||||||
|
//
|
||||||
|
// Name Reg Size
|
||||||
|
// ------------ ----- ----
|
||||||
|
// combinedMat c0 4
|
||||||
|
// matCol c12 1
|
||||||
|
// surfProps c13 1
|
||||||
|
// ambientLight c14 1
|
||||||
|
//
|
||||||
|
|
||||||
|
vs_2_0
|
||||||
|
def c4, 0, -0, -1, 1
|
||||||
|
dcl_position v0
|
||||||
|
dcl_texcoord v1
|
||||||
|
dcl_color v2
|
||||||
|
mul r0, v0.y, c1
|
||||||
|
mad r0, c0, v0.x, r0
|
||||||
|
mad r0, c2, v0.z, r0
|
||||||
|
mad oPos, c3, v0.w, r0
|
||||||
|
mov r0.x, c4.x
|
||||||
|
slt r0.x, r0.x, c13.w
|
||||||
|
add r1, v2, c4.yyyz
|
||||||
|
mad r0, r0.x, r1, c4.xxxw
|
||||||
|
mov r1.x, c13.x
|
||||||
|
mad r0.xyz, c14, r1.x, r0
|
||||||
|
max r0, r0, c4.x
|
||||||
|
min r0, r0, c4.w
|
||||||
|
mul oD0, r0, c12
|
||||||
|
mov oT0.xy, v1
|
||||||
|
|
||||||
|
// approximately 14 instruction slots used
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const BYTE g_vs20_main[] =
|
||||||
|
{
|
||||||
|
0, 2, 254, 255, 254, 255,
|
||||||
|
62, 0, 67, 84, 65, 66,
|
||||||
|
28, 0, 0, 0, 192, 0,
|
||||||
|
0, 0, 0, 2, 254, 255,
|
||||||
|
4, 0, 0, 0, 28, 0,
|
||||||
|
0, 0, 0, 1, 0, 0,
|
||||||
|
185, 0, 0, 0, 108, 0,
|
||||||
|
0, 0, 2, 0, 14, 0,
|
||||||
|
1, 0, 58, 0, 124, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
140, 0, 0, 0, 2, 0,
|
||||||
|
0, 0, 4, 0, 2, 0,
|
||||||
|
152, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 168, 0, 0, 0,
|
||||||
|
2, 0, 12, 0, 1, 0,
|
||||||
|
50, 0, 124, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 175, 0,
|
||||||
|
0, 0, 2, 0, 13, 0,
|
||||||
|
1, 0, 54, 0, 124, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
97, 109, 98, 105, 101, 110,
|
||||||
|
116, 76, 105, 103, 104, 116,
|
||||||
|
0, 171, 171, 171, 1, 0,
|
||||||
|
3, 0, 1, 0, 4, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 99, 111, 109, 98,
|
||||||
|
105, 110, 101, 100, 77, 97,
|
||||||
|
116, 0, 3, 0, 3, 0,
|
||||||
|
4, 0, 4, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
109, 97, 116, 67, 111, 108,
|
||||||
|
0, 115, 117, 114, 102, 80,
|
||||||
|
114, 111, 112, 115, 0, 118,
|
||||||
|
115, 95, 50, 95, 48, 0,
|
||||||
|
77, 105, 99, 114, 111, 115,
|
||||||
|
111, 102, 116, 32, 40, 82,
|
||||||
|
41, 32, 72, 76, 83, 76,
|
||||||
|
32, 83, 104, 97, 100, 101,
|
||||||
|
114, 32, 67, 111, 109, 112,
|
||||||
|
105, 108, 101, 114, 32, 57,
|
||||||
|
46, 50, 57, 46, 57, 53,
|
||||||
|
50, 46, 51, 49, 49, 49,
|
||||||
|
0, 171, 171, 171, 81, 0,
|
||||||
|
0, 5, 4, 0, 15, 160,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 128, 0, 0, 128, 191,
|
||||||
|
0, 0, 128, 63, 31, 0,
|
||||||
|
0, 2, 0, 0, 0, 128,
|
||||||
|
0, 0, 15, 144, 31, 0,
|
||||||
|
0, 2, 5, 0, 0, 128,
|
||||||
|
1, 0, 15, 144, 31, 0,
|
||||||
|
0, 2, 10, 0, 0, 128,
|
||||||
|
2, 0, 15, 144, 5, 0,
|
||||||
|
0, 3, 0, 0, 15, 128,
|
||||||
|
0, 0, 85, 144, 1, 0,
|
||||||
|
228, 160, 4, 0, 0, 4,
|
||||||
|
0, 0, 15, 128, 0, 0,
|
||||||
|
228, 160, 0, 0, 0, 144,
|
||||||
|
0, 0, 228, 128, 4, 0,
|
||||||
|
0, 4, 0, 0, 15, 128,
|
||||||
|
2, 0, 228, 160, 0, 0,
|
||||||
|
170, 144, 0, 0, 228, 128,
|
||||||
|
4, 0, 0, 4, 0, 0,
|
||||||
|
15, 192, 3, 0, 228, 160,
|
||||||
|
0, 0, 255, 144, 0, 0,
|
||||||
|
228, 128, 1, 0, 0, 2,
|
||||||
|
0, 0, 1, 128, 4, 0,
|
||||||
|
0, 160, 12, 0, 0, 3,
|
||||||
|
0, 0, 1, 128, 0, 0,
|
||||||
|
0, 128, 13, 0, 255, 160,
|
||||||
|
2, 0, 0, 3, 1, 0,
|
||||||
|
15, 128, 2, 0, 228, 144,
|
||||||
|
4, 0, 149, 160, 4, 0,
|
||||||
|
0, 4, 0, 0, 15, 128,
|
||||||
|
0, 0, 0, 128, 1, 0,
|
||||||
|
228, 128, 4, 0, 192, 160,
|
||||||
|
1, 0, 0, 2, 1, 0,
|
||||||
|
1, 128, 13, 0, 0, 160,
|
||||||
|
4, 0, 0, 4, 0, 0,
|
||||||
|
7, 128, 14, 0, 228, 160,
|
||||||
|
1, 0, 0, 128, 0, 0,
|
||||||
|
228, 128, 11, 0, 0, 3,
|
||||||
|
0, 0, 15, 128, 0, 0,
|
||||||
|
228, 128, 4, 0, 0, 160,
|
||||||
|
10, 0, 0, 3, 0, 0,
|
||||||
|
15, 128, 0, 0, 228, 128,
|
||||||
|
4, 0, 255, 160, 5, 0,
|
||||||
|
0, 3, 0, 0, 15, 208,
|
||||||
|
0, 0, 228, 128, 12, 0,
|
||||||
|
228, 160, 1, 0, 0, 2,
|
||||||
|
0, 0, 3, 224, 1, 0,
|
||||||
|
228, 144, 255, 255, 0, 0
|
||||||
|
};
|
264
src/d3d/shaders/default_amb_dir_VS.h
Normal file
264
src/d3d/shaders/default_amb_dir_VS.h
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
#if 0
|
||||||
|
//
|
||||||
|
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||||
|
//
|
||||||
|
// fxc /T vs_2_0 /DDIRECTIONALS /Fh default_amb_dir_VS.h defaultVS.hlsl
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// float4 ambientLight;
|
||||||
|
// float4x4 combinedMat;
|
||||||
|
// int4 firstLight;
|
||||||
|
//
|
||||||
|
// struct
|
||||||
|
// {
|
||||||
|
// float4 color;
|
||||||
|
// float4 position;
|
||||||
|
// float4 direction;
|
||||||
|
//
|
||||||
|
// } lights[8];
|
||||||
|
//
|
||||||
|
// float4 matCol;
|
||||||
|
// float3x3 normalMat;
|
||||||
|
// int numDirLights;
|
||||||
|
// float4 surfProps;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Registers:
|
||||||
|
//
|
||||||
|
// Name Reg Size
|
||||||
|
// ------------ ----- ----
|
||||||
|
// numDirLights i0 1
|
||||||
|
// combinedMat c0 4
|
||||||
|
// normalMat c8 3
|
||||||
|
// matCol c12 1
|
||||||
|
// surfProps c13 1
|
||||||
|
// ambientLight c14 1
|
||||||
|
// firstLight c15 1
|
||||||
|
// lights c16 24
|
||||||
|
//
|
||||||
|
|
||||||
|
vs_2_0
|
||||||
|
def c4, 3, 0, 0, 0
|
||||||
|
def c5, 0, -0, -1, 1
|
||||||
|
dcl_position v0
|
||||||
|
dcl_normal v1
|
||||||
|
dcl_texcoord v2
|
||||||
|
dcl_color v3
|
||||||
|
mul r0, v0.y, c1
|
||||||
|
mad r0, c0, v0.x, r0
|
||||||
|
mad r0, c2, v0.z, r0
|
||||||
|
mad oPos, c3, v0.w, r0
|
||||||
|
mul r0.xyz, v1.y, c9
|
||||||
|
mad r0.xyz, c8, v1.x, r0
|
||||||
|
mad r0.xyz, c10, v1.z, r0
|
||||||
|
mov r1.x, c5.x
|
||||||
|
slt r0.w, r1.x, c13.w
|
||||||
|
add r1, v3, c5.yyyz
|
||||||
|
mad r1, r0.w, r1, c5.xxxw
|
||||||
|
mov r2.x, c13.x
|
||||||
|
mad r2.xyz, c14, r2.x, r1
|
||||||
|
mov r1.xyz, r2
|
||||||
|
mov r0.w, c5.x
|
||||||
|
rep i0
|
||||||
|
add r2.w, r0.w, c15.x
|
||||||
|
mul r2.w, r2.w, c4.x
|
||||||
|
mova a0.x, r2.w
|
||||||
|
dp3 r2.w, r0, -c18[a0.x]
|
||||||
|
max r2.w, r2.w, c5.x
|
||||||
|
mul r3.xyz, r2.w, c16[a0.x]
|
||||||
|
mad r1.xyz, r3, c13.z, r1
|
||||||
|
add r0.w, r0.w, c5.w
|
||||||
|
endrep
|
||||||
|
max r0, r1, c5.x
|
||||||
|
min r0, r0, c5.w
|
||||||
|
mul oD0, r0, c12
|
||||||
|
mov oT0.xy, v2
|
||||||
|
|
||||||
|
// approximately 32 instruction slots used
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const BYTE g_vs20_main[] =
|
||||||
|
{
|
||||||
|
0, 2, 254, 255, 254, 255,
|
||||||
|
127, 0, 67, 84, 65, 66,
|
||||||
|
28, 0, 0, 0, 197, 1,
|
||||||
|
0, 0, 0, 2, 254, 255,
|
||||||
|
8, 0, 0, 0, 28, 0,
|
||||||
|
0, 0, 0, 1, 0, 0,
|
||||||
|
190, 1, 0, 0, 188, 0,
|
||||||
|
0, 0, 2, 0, 14, 0,
|
||||||
|
1, 0, 58, 0, 204, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
220, 0, 0, 0, 2, 0,
|
||||||
|
0, 0, 4, 0, 2, 0,
|
||||||
|
232, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 248, 0, 0, 0,
|
||||||
|
2, 0, 15, 0, 1, 0,
|
||||||
|
62, 0, 4, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 20, 1,
|
||||||
|
0, 0, 2, 0, 16, 0,
|
||||||
|
24, 0, 66, 0, 96, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
112, 1, 0, 0, 2, 0,
|
||||||
|
12, 0, 1, 0, 50, 0,
|
||||||
|
204, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 119, 1, 0, 0,
|
||||||
|
2, 0, 8, 0, 3, 0,
|
||||||
|
34, 0, 132, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 148, 1,
|
||||||
|
0, 0, 1, 0, 0, 0,
|
||||||
|
1, 0, 2, 0, 164, 1,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
180, 1, 0, 0, 2, 0,
|
||||||
|
13, 0, 1, 0, 54, 0,
|
||||||
|
204, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 97, 109, 98, 105,
|
||||||
|
101, 110, 116, 76, 105, 103,
|
||||||
|
104, 116, 0, 171, 171, 171,
|
||||||
|
1, 0, 3, 0, 1, 0,
|
||||||
|
4, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 99, 111,
|
||||||
|
109, 98, 105, 110, 101, 100,
|
||||||
|
77, 97, 116, 0, 3, 0,
|
||||||
|
3, 0, 4, 0, 4, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 102, 105, 114, 115,
|
||||||
|
116, 76, 105, 103, 104, 116,
|
||||||
|
0, 171, 1, 0, 2, 0,
|
||||||
|
1, 0, 4, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
108, 105, 103, 104, 116, 115,
|
||||||
|
0, 99, 111, 108, 111, 114,
|
||||||
|
0, 171, 171, 171, 1, 0,
|
||||||
|
3, 0, 1, 0, 4, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 112, 111, 115, 105,
|
||||||
|
116, 105, 111, 110, 0, 100,
|
||||||
|
105, 114, 101, 99, 116, 105,
|
||||||
|
111, 110, 0, 171, 27, 1,
|
||||||
|
0, 0, 36, 1, 0, 0,
|
||||||
|
52, 1, 0, 0, 36, 1,
|
||||||
|
0, 0, 61, 1, 0, 0,
|
||||||
|
36, 1, 0, 0, 5, 0,
|
||||||
|
0, 0, 1, 0, 12, 0,
|
||||||
|
8, 0, 3, 0, 72, 1,
|
||||||
|
0, 0, 109, 97, 116, 67,
|
||||||
|
111, 108, 0, 110, 111, 114,
|
||||||
|
109, 97, 108, 77, 97, 116,
|
||||||
|
0, 171, 171, 171, 3, 0,
|
||||||
|
3, 0, 3, 0, 3, 0,
|
||||||
|
1, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 110, 117, 109, 68,
|
||||||
|
105, 114, 76, 105, 103, 104,
|
||||||
|
116, 115, 0, 171, 171, 171,
|
||||||
|
0, 0, 2, 0, 1, 0,
|
||||||
|
1, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 115, 117,
|
||||||
|
114, 102, 80, 114, 111, 112,
|
||||||
|
115, 0, 118, 115, 95, 50,
|
||||||
|
95, 48, 0, 77, 105, 99,
|
||||||
|
114, 111, 115, 111, 102, 116,
|
||||||
|
32, 40, 82, 41, 32, 72,
|
||||||
|
76, 83, 76, 32, 83, 104,
|
||||||
|
97, 100, 101, 114, 32, 67,
|
||||||
|
111, 109, 112, 105, 108, 101,
|
||||||
|
114, 32, 57, 46, 50, 57,
|
||||||
|
46, 57, 53, 50, 46, 51,
|
||||||
|
49, 49, 49, 0, 171, 171,
|
||||||
|
81, 0, 0, 5, 4, 0,
|
||||||
|
15, 160, 0, 0, 64, 64,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
81, 0, 0, 5, 5, 0,
|
||||||
|
15, 160, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 128, 0, 0,
|
||||||
|
128, 191, 0, 0, 128, 63,
|
||||||
|
31, 0, 0, 2, 0, 0,
|
||||||
|
0, 128, 0, 0, 15, 144,
|
||||||
|
31, 0, 0, 2, 3, 0,
|
||||||
|
0, 128, 1, 0, 15, 144,
|
||||||
|
31, 0, 0, 2, 5, 0,
|
||||||
|
0, 128, 2, 0, 15, 144,
|
||||||
|
31, 0, 0, 2, 10, 0,
|
||||||
|
0, 128, 3, 0, 15, 144,
|
||||||
|
5, 0, 0, 3, 0, 0,
|
||||||
|
15, 128, 0, 0, 85, 144,
|
||||||
|
1, 0, 228, 160, 4, 0,
|
||||||
|
0, 4, 0, 0, 15, 128,
|
||||||
|
0, 0, 228, 160, 0, 0,
|
||||||
|
0, 144, 0, 0, 228, 128,
|
||||||
|
4, 0, 0, 4, 0, 0,
|
||||||
|
15, 128, 2, 0, 228, 160,
|
||||||
|
0, 0, 170, 144, 0, 0,
|
||||||
|
228, 128, 4, 0, 0, 4,
|
||||||
|
0, 0, 15, 192, 3, 0,
|
||||||
|
228, 160, 0, 0, 255, 144,
|
||||||
|
0, 0, 228, 128, 5, 0,
|
||||||
|
0, 3, 0, 0, 7, 128,
|
||||||
|
1, 0, 85, 144, 9, 0,
|
||||||
|
228, 160, 4, 0, 0, 4,
|
||||||
|
0, 0, 7, 128, 8, 0,
|
||||||
|
228, 160, 1, 0, 0, 144,
|
||||||
|
0, 0, 228, 128, 4, 0,
|
||||||
|
0, 4, 0, 0, 7, 128,
|
||||||
|
10, 0, 228, 160, 1, 0,
|
||||||
|
170, 144, 0, 0, 228, 128,
|
||||||
|
1, 0, 0, 2, 1, 0,
|
||||||
|
1, 128, 5, 0, 0, 160,
|
||||||
|
12, 0, 0, 3, 0, 0,
|
||||||
|
8, 128, 1, 0, 0, 128,
|
||||||
|
13, 0, 255, 160, 2, 0,
|
||||||
|
0, 3, 1, 0, 15, 128,
|
||||||
|
3, 0, 228, 144, 5, 0,
|
||||||
|
149, 160, 4, 0, 0, 4,
|
||||||
|
1, 0, 15, 128, 0, 0,
|
||||||
|
255, 128, 1, 0, 228, 128,
|
||||||
|
5, 0, 192, 160, 1, 0,
|
||||||
|
0, 2, 2, 0, 1, 128,
|
||||||
|
13, 0, 0, 160, 4, 0,
|
||||||
|
0, 4, 2, 0, 7, 128,
|
||||||
|
14, 0, 228, 160, 2, 0,
|
||||||
|
0, 128, 1, 0, 228, 128,
|
||||||
|
1, 0, 0, 2, 1, 0,
|
||||||
|
7, 128, 2, 0, 228, 128,
|
||||||
|
1, 0, 0, 2, 0, 0,
|
||||||
|
8, 128, 5, 0, 0, 160,
|
||||||
|
38, 0, 0, 1, 0, 0,
|
||||||
|
228, 240, 2, 0, 0, 3,
|
||||||
|
2, 0, 8, 128, 0, 0,
|
||||||
|
255, 128, 15, 0, 0, 160,
|
||||||
|
5, 0, 0, 3, 2, 0,
|
||||||
|
8, 128, 2, 0, 255, 128,
|
||||||
|
4, 0, 0, 160, 46, 0,
|
||||||
|
0, 2, 0, 0, 1, 176,
|
||||||
|
2, 0, 255, 128, 8, 0,
|
||||||
|
0, 4, 2, 0, 8, 128,
|
||||||
|
0, 0, 228, 128, 18, 32,
|
||||||
|
228, 161, 0, 0, 0, 176,
|
||||||
|
11, 0, 0, 3, 2, 0,
|
||||||
|
8, 128, 2, 0, 255, 128,
|
||||||
|
5, 0, 0, 160, 5, 0,
|
||||||
|
0, 4, 3, 0, 7, 128,
|
||||||
|
2, 0, 255, 128, 16, 32,
|
||||||
|
228, 160, 0, 0, 0, 176,
|
||||||
|
4, 0, 0, 4, 1, 0,
|
||||||
|
7, 128, 3, 0, 228, 128,
|
||||||
|
13, 0, 170, 160, 1, 0,
|
||||||
|
228, 128, 2, 0, 0, 3,
|
||||||
|
0, 0, 8, 128, 0, 0,
|
||||||
|
255, 128, 5, 0, 255, 160,
|
||||||
|
39, 0, 0, 0, 11, 0,
|
||||||
|
0, 3, 0, 0, 15, 128,
|
||||||
|
1, 0, 228, 128, 5, 0,
|
||||||
|
0, 160, 10, 0, 0, 3,
|
||||||
|
0, 0, 15, 128, 0, 0,
|
||||||
|
228, 128, 5, 0, 255, 160,
|
||||||
|
5, 0, 0, 3, 0, 0,
|
||||||
|
15, 208, 0, 0, 228, 128,
|
||||||
|
12, 0, 228, 160, 1, 0,
|
||||||
|
0, 2, 0, 0, 3, 224,
|
||||||
|
2, 0, 228, 144, 255, 255,
|
||||||
|
0, 0
|
||||||
|
};
|
37
src/d3d/shaders/default_color_PS.h
Normal file
37
src/d3d/shaders/default_color_PS.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#if 0
|
||||||
|
//
|
||||||
|
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||||
|
//
|
||||||
|
// fxc /T ps_2_0 /Fh default_color_PS.h default_color_PS.hlsl
|
||||||
|
//
|
||||||
|
ps_2_0
|
||||||
|
dcl v0
|
||||||
|
mov oC0, v0
|
||||||
|
|
||||||
|
// approximately 1 instruction slot used
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const BYTE g_ps20_main[] =
|
||||||
|
{
|
||||||
|
0, 2, 255, 255, 254, 255,
|
||||||
|
22, 0, 67, 84, 65, 66,
|
||||||
|
28, 0, 0, 0, 35, 0,
|
||||||
|
0, 0, 0, 2, 255, 255,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 1, 0, 0,
|
||||||
|
28, 0, 0, 0, 112, 115,
|
||||||
|
95, 50, 95, 48, 0, 77,
|
||||||
|
105, 99, 114, 111, 115, 111,
|
||||||
|
102, 116, 32, 40, 82, 41,
|
||||||
|
32, 72, 76, 83, 76, 32,
|
||||||
|
83, 104, 97, 100, 101, 114,
|
||||||
|
32, 67, 111, 109, 112, 105,
|
||||||
|
108, 101, 114, 32, 57, 46,
|
||||||
|
50, 57, 46, 57, 53, 50,
|
||||||
|
46, 51, 49, 49, 49, 0,
|
||||||
|
31, 0, 0, 2, 0, 0,
|
||||||
|
0, 128, 0, 0, 15, 144,
|
||||||
|
1, 0, 0, 2, 0, 8,
|
||||||
|
15, 128, 0, 0, 228, 144,
|
||||||
|
255, 255, 0, 0
|
||||||
|
};
|
10
src/d3d/shaders/default_color_PS.hlsl
Normal file
10
src/d3d/shaders/default_color_PS.hlsl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
struct VS_out {
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float2 TexCoord0 : TEXCOORD0;
|
||||||
|
float4 Color : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(VS_out input) : COLOR
|
||||||
|
{
|
||||||
|
return input.Color;
|
||||||
|
}
|
71
src/d3d/shaders/default_color_tex_PS.h
Normal file
71
src/d3d/shaders/default_color_tex_PS.h
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#if 0
|
||||||
|
//
|
||||||
|
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||||
|
//
|
||||||
|
// fxc /T ps_2_0 /Fh default_color_tex_PS.h default_color_tex_PS.hlsl
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// sampler2D tex0;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Registers:
|
||||||
|
//
|
||||||
|
// Name Reg Size
|
||||||
|
// ------------ ----- ----
|
||||||
|
// tex0 s0 1
|
||||||
|
//
|
||||||
|
|
||||||
|
ps_2_0
|
||||||
|
dcl t0.xy
|
||||||
|
dcl v0
|
||||||
|
dcl_2d s0
|
||||||
|
texld r0, t0, s0
|
||||||
|
mul r0, r0, v0
|
||||||
|
mov oC0, r0
|
||||||
|
|
||||||
|
// approximately 3 instruction slots used (1 texture, 2 arithmetic)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const BYTE g_ps20_main[] =
|
||||||
|
{
|
||||||
|
0, 2, 255, 255, 254, 255,
|
||||||
|
33, 0, 67, 84, 65, 66,
|
||||||
|
28, 0, 0, 0, 79, 0,
|
||||||
|
0, 0, 0, 2, 255, 255,
|
||||||
|
1, 0, 0, 0, 28, 0,
|
||||||
|
0, 0, 0, 1, 0, 0,
|
||||||
|
72, 0, 0, 0, 48, 0,
|
||||||
|
0, 0, 3, 0, 0, 0,
|
||||||
|
1, 0, 2, 0, 56, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
116, 101, 120, 48, 0, 171,
|
||||||
|
171, 171, 4, 0, 12, 0,
|
||||||
|
1, 0, 1, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
112, 115, 95, 50, 95, 48,
|
||||||
|
0, 77, 105, 99, 114, 111,
|
||||||
|
115, 111, 102, 116, 32, 40,
|
||||||
|
82, 41, 32, 72, 76, 83,
|
||||||
|
76, 32, 83, 104, 97, 100,
|
||||||
|
101, 114, 32, 67, 111, 109,
|
||||||
|
112, 105, 108, 101, 114, 32,
|
||||||
|
57, 46, 50, 57, 46, 57,
|
||||||
|
53, 50, 46, 51, 49, 49,
|
||||||
|
49, 0, 31, 0, 0, 2,
|
||||||
|
0, 0, 0, 128, 0, 0,
|
||||||
|
3, 176, 31, 0, 0, 2,
|
||||||
|
0, 0, 0, 128, 0, 0,
|
||||||
|
15, 144, 31, 0, 0, 2,
|
||||||
|
0, 0, 0, 144, 0, 8,
|
||||||
|
15, 160, 66, 0, 0, 3,
|
||||||
|
0, 0, 15, 128, 0, 0,
|
||||||
|
228, 176, 0, 8, 228, 160,
|
||||||
|
5, 0, 0, 3, 0, 0,
|
||||||
|
15, 128, 0, 0, 228, 128,
|
||||||
|
0, 0, 228, 144, 1, 0,
|
||||||
|
0, 2, 0, 8, 15, 128,
|
||||||
|
0, 0, 228, 128, 255, 255,
|
||||||
|
0, 0
|
||||||
|
};
|
13
src/d3d/shaders/default_color_tex_PS.hlsl
Normal file
13
src/d3d/shaders/default_color_tex_PS.hlsl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
struct VS_out {
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float2 TexCoord0 : TEXCOORD0;
|
||||||
|
float4 Color : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
sampler2D tex0 : register(s0);
|
||||||
|
|
||||||
|
|
||||||
|
float4 main(VS_out input) : COLOR
|
||||||
|
{
|
||||||
|
return tex2D(tex0, input.TexCoord0.xy) * input.Color;
|
||||||
|
}
|
25
src/d3d/shaders/im3d_VS.hlsl
Normal file
25
src/d3d/shaders/im3d_VS.hlsl
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
float4x4 combinedMat : register(c0);
|
||||||
|
|
||||||
|
struct VS_in
|
||||||
|
{
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float2 TexCoord : TEXCOORD0;
|
||||||
|
float4 Color : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VS_out {
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float2 TexCoord0 : TEXCOORD0;
|
||||||
|
float4 Color : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
VS_out main(in VS_in input)
|
||||||
|
{
|
||||||
|
VS_out output;
|
||||||
|
|
||||||
|
output.Position = mul(combinedMat, input.Position);
|
||||||
|
output.TexCoord0 = input.TexCoord;
|
||||||
|
output.Color = input.Color;
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
39
src/d3d/shaders/lighting.h
Normal file
39
src/d3d/shaders/lighting.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
struct Light
|
||||||
|
{
|
||||||
|
float4 color; // and radius
|
||||||
|
float4 position; // and -cos(angle)
|
||||||
|
float4 direction; // and falloff clamp
|
||||||
|
};
|
||||||
|
|
||||||
|
float3 DoDirLight(Light L, float3 N)
|
||||||
|
{
|
||||||
|
float l = max(0.0, dot(N, -L.direction.xyz));
|
||||||
|
return l*L.color.xyz;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 DoPointLight(Light L, float3 V, float3 N)
|
||||||
|
{
|
||||||
|
// As on PS2
|
||||||
|
float3 dir = V - L.position.xyz;
|
||||||
|
float dist = length(dir);
|
||||||
|
float atten = max(0.0, (1.0 - dist/L.color.w));
|
||||||
|
float l = max(0.0, dot(N, -normalize(dir)));
|
||||||
|
return l*L.color.xyz*atten;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 DoSpotLight(Light L, float3 V, float3 N)
|
||||||
|
{
|
||||||
|
// As on PS2
|
||||||
|
float3 dir = V - L.position.xyz;
|
||||||
|
float dist = length(dir);
|
||||||
|
float atten = max(0.0, (1.0 - dist/L.color.w));
|
||||||
|
dir /= dist;
|
||||||
|
float l = max(0.0, dot(N, -dir));
|
||||||
|
float pcos = dot(dir, L.direction.xyz); // cos to point
|
||||||
|
float ccos = -L.position.w; // cos of cone
|
||||||
|
float falloff = (pcos-ccos)/(1.0-ccos);
|
||||||
|
if(falloff < 0) // outside of cone
|
||||||
|
l = 0;
|
||||||
|
l *= max(falloff, L.direction.w); // falloff clamp
|
||||||
|
return l*L.color.xyz*atten;
|
||||||
|
}
|
7
src/d3d/shaders/make.cmd
Normal file
7
src/d3d/shaders/make.cmd
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T vs_2_0 /Fh default_amb_VS.h defaultVS.hlsl
|
||||||
|
"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T vs_2_0 /DDIRECTIONALS /Fh default_amb_dir_VS.h defaultVS.hlsl
|
||||||
|
"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T vs_2_0 /DDIRECTIONALS /DPOINTLIGHTS /DSPOTLIGHTS /Fh default_all_VS.h defaultVS.hlsl
|
||||||
|
|
||||||
|
"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T ps_2_0 /Fh default_color_PS.h default_color_PS.hlsl
|
||||||
|
"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T ps_2_0 /Fh default_color_tex_PS.h default_color_tex_PS.hlsl
|
@ -163,6 +163,7 @@ MatFX::setBumpTexture(Texture *t)
|
|||||||
if(this->fx[i].bump.tex)
|
if(this->fx[i].bump.tex)
|
||||||
this->fx[i].bump.tex->destroy();
|
this->fx[i].bump.tex->destroy();
|
||||||
this->fx[i].bump.tex = t;
|
this->fx[i].bump.tex = t;
|
||||||
|
if(t)
|
||||||
t->refCount++;
|
t->refCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,6 +202,7 @@ MatFX::setEnvTexture(Texture *t)
|
|||||||
if(this->fx[i].env.tex)
|
if(this->fx[i].env.tex)
|
||||||
this->fx[i].env.tex->destroy();
|
this->fx[i].env.tex->destroy();
|
||||||
this->fx[i].env.tex = t;
|
this->fx[i].env.tex = t;
|
||||||
|
if(t)
|
||||||
t->refCount++;
|
t->refCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,6 +259,7 @@ MatFX::setDualTexture(Texture *t)
|
|||||||
if(this->fx[i].dual.tex)
|
if(this->fx[i].dual.tex)
|
||||||
this->fx[i].dual.tex->destroy();
|
this->fx[i].dual.tex->destroy();
|
||||||
this->fx[i].dual.tex = t;
|
this->fx[i].dual.tex = t;
|
||||||
|
if(t)
|
||||||
t->refCount++;
|
t->refCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,8 @@ struct VideoMode
|
|||||||
uint32 flags;
|
uint32 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Camera;
|
||||||
|
struct World;
|
||||||
|
|
||||||
// This is for platform independent things
|
// This is for platform independent things
|
||||||
// TODO: move more stuff into this
|
// TODO: move more stuff into this
|
||||||
@ -146,8 +148,8 @@ struct Engine
|
|||||||
Opened,
|
Opened,
|
||||||
Started
|
Started
|
||||||
};
|
};
|
||||||
void *currentCamera;
|
Camera *currentCamera;
|
||||||
void *currentWorld;
|
World *currentWorld;
|
||||||
LinkList frameDirtyList;
|
LinkList frameDirtyList;
|
||||||
|
|
||||||
// Dynamically allocated because of plugins
|
// Dynamically allocated because of plugins
|
||||||
|
@ -734,6 +734,7 @@ struct Clump
|
|||||||
// used by enumerateLights for lighting callback
|
// used by enumerateLights for lighting callback
|
||||||
struct WorldLights
|
struct WorldLights
|
||||||
{
|
{
|
||||||
|
int32 numAmbients;
|
||||||
RGBAf ambient; // all ambients added
|
RGBAf ambient; // all ambients added
|
||||||
int32 numDirectionals;
|
int32 numDirectionals;
|
||||||
Light **directionals; // only directionals
|
Light **directionals; // only directionals
|
||||||
|
@ -149,6 +149,7 @@ World::enumerateLights(Atomic *atomic, WorldLights *lightData)
|
|||||||
|
|
||||||
lightData->numDirectionals = 0;
|
lightData->numDirectionals = 0;
|
||||||
lightData->numLocals = 0;
|
lightData->numLocals = 0;
|
||||||
|
lightData->numAmbients = 0;
|
||||||
lightData->ambient.red = 0.0f;
|
lightData->ambient.red = 0.0f;
|
||||||
lightData->ambient.green = 0.0f;
|
lightData->ambient.green = 0.0f;
|
||||||
lightData->ambient.blue = 0.0f;
|
lightData->ambient.blue = 0.0f;
|
||||||
@ -164,6 +165,7 @@ World::enumerateLights(Atomic *atomic, WorldLights *lightData)
|
|||||||
lightData->ambient.red += l->color.red;
|
lightData->ambient.red += l->color.red;
|
||||||
lightData->ambient.green += l->color.green;
|
lightData->ambient.green += l->color.green;
|
||||||
lightData->ambient.blue += l->color.blue;
|
lightData->ambient.blue += l->color.blue;
|
||||||
|
lightData->numAmbients++;
|
||||||
}else if(normals && l->getType() == Light::DIRECTIONAL){
|
}else if(normals && l->getType() == Light::DIRECTIONAL){
|
||||||
if(lightData->numDirectionals < maxDirectionals)
|
if(lightData->numDirectionals < maxDirectionals)
|
||||||
lightData->directionals[lightData->numDirectionals++] = l;
|
lightData->directionals[lightData->numDirectionals++] = l;
|
||||||
|
Loading…
Reference in New Issue
Block a user