Commit 0efce9c9 authored by engineer_apple's avatar engineer_apple

-------------------------------------------

Changes in version 1.4 (... 13.11.2007)
- Fixed somed CQuake3ShaderSceneNode problems.
- Changed BurningsVideo internal Vertex Format. version changed to 0.39
- SceneManager:
   Removed the seperate rendering states for quake3 Shader Scene Nodes.
   Nodes are now solid or transparent. ( but still more states are needed )


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1047 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 201ce2c1
......@@ -209,13 +209,13 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
if ( Mesh )
{
/*
/*
scene::IMesh *m = Mesh->getMesh(CurrentFrameNr, 255, StartFrame, EndFrame);
if ( m )
{
Box = m->getBoundingBox();
}
*/
*/
}
......
......@@ -50,10 +50,9 @@ CBillboardSceneNode::CBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr,
void CBillboardSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
}
}
......
This diff is collapsed.
......@@ -221,7 +221,6 @@ void CCameraSceneNode::OnRegisterSceneNode()
if ( SceneManager->getActiveCamera () == this )
SceneManager->registerNodeForRendering(this, ESNRP_CAMERA);
if (IsVisible)
ISceneNode::OnRegisterSceneNode();
}
......
......@@ -106,10 +106,8 @@ const core::aabbox3d<f32>& CCubeSceneNode::getBoundingBox() const
void CCubeSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
}
}
......
......@@ -102,7 +102,9 @@ public:
unpack_texureBlendFunc ( srcFact, dstFact, modulate, material.MaterialTypeParam );
if (srcFact == EBF_SRC_COLOR && dstFact == EBF_ZERO)
{
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
}
else
{
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
......@@ -180,6 +182,8 @@ public:
return r;
}
bool transparent;
};
......
......@@ -65,7 +65,8 @@ void CDepthBuffer::setSize(const core::dimension2d<s32>& size)
if (Buffer)
delete [] Buffer;
TotalSize = size.Width * size.Height * sizeof ( fp24 );
Pitch = size.Width * sizeof ( fp24 );
TotalSize = Pitch * size.Height;
Buffer = new u8[TotalSize];
}
......@@ -79,19 +80,6 @@ const core::dimension2d<s32>& CDepthBuffer::getSize() const
//! locks the zbuffer
fp24* CDepthBuffer::lock()
{
return (fp24*) Buffer;
}
//! unlocks the zbuffer
void CDepthBuffer::unlock()
{
}
} // end namespace video
} // end namespace irr
......
......@@ -32,16 +32,29 @@ namespace video
virtual const core::dimension2d<s32>& getSize() const;
//! locks the zbuffer
virtual fp24* lock();
virtual void* lock()
{
return (void*) Buffer;
}
//! unlocks the zbuffer
virtual void unlock();
virtual void unlock()
{
}
//! returns pitch of depthbuffer (in bytes)
virtual u32 getPitch() const
{
return Pitch;
}
private:
u8* Buffer;
core::dimension2d<s32> Size;
u32 TotalSize;
u32 Pitch;
};
} // end namespace video
......
......@@ -27,10 +27,9 @@ CEmptySceneNode::CEmptySceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
void CEmptySceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
}
}
......
......@@ -39,10 +39,9 @@ void CLightSceneNode::OnRegisterSceneNode()
doLightRecalc();
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, ESNRP_LIGHT);
ISceneNode::OnRegisterSceneNode();
}
}
......
......@@ -625,7 +625,7 @@ s32 CQ3LevelMesh::setShaderMaterial ( video::SMaterial &material, const tBSPFace
if ( face->lightmapID >= 0 )
{
material.setTexture(1, Lightmap [ face->lightmapID ]);
material.MaterialType = quake3::defaultLightMap;
material.MaterialType = quake3::defaultMaterialType;
}
// store shader ID
......@@ -643,7 +643,7 @@ s32 CQ3LevelMesh::setShaderMaterial ( video::SMaterial &material, const tBSPFace
group = shader->getGroup ( 1 );
if ( group )
{
material.BackfaceCulling = quake3::getBackfaceCulling ( group->get ( "cull" ) );
material.BackfaceCulling = quake3::isDisabled ( group->get ( "cull" ) );
if ( group->isDefined ( "surfaceparm", "nolightmap" ) )
{
......@@ -668,7 +668,7 @@ s32 CQ3LevelMesh::setShaderMaterial ( video::SMaterial &material, const tBSPFace
index = group->getIndex ( "depthwrite" );
if ( index >= 0 )
{
material.ZBuffer = true;
material.ZWriteEnable = true;
}
quake3::SBlendFunc blendfunc;
......@@ -807,7 +807,7 @@ void CQ3LevelMesh::constructMesh2()
{
if ( 0 == toBuffer[g].takeVertexColor )
{
toBuffer[g].takeVertexColor = material.getTexture(0) == 0 || material.getTexture(1);
toBuffer[g].takeVertexColor = material.getTexture(0) == 0 || material.getTexture(1) == 0;
}
if (Faces[i].lightmapID < -1 || Faces[i].lightmapID > NumLightMaps-1)
{
......@@ -821,8 +821,24 @@ void CQ3LevelMesh::constructMesh2()
}
else
{
// Construct a unique mesh for each shader or combine meshbuffers for same shader
#if 0
buffer = 0;
if ( shader )
{
const quake3::SVarGroup *group = shader->getGroup ( 1 );
if ( group )
{
if ( group->getIndex ( "deformvertexes" ) >= 0 )
{
buffer = (SMeshBufferLightMap*) Mesh[ toBuffer[g].index ]->getMeshBuffer ( material );
}
}
}
#else
buffer = (SMeshBufferLightMap*) Mesh[ toBuffer[g].index ]->getMeshBuffer ( material );
//buffer = 0;
#endif
if ( 0 == buffer )
{
buffer = new scene::SMeshBufferLightMap();
......@@ -1415,6 +1431,7 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN
{
quake3::SShader search;
search.name = filename;
search.name.replace ( '\\', '/' );
s32 index;
......@@ -1431,7 +1448,7 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN
{
// extract the shader name from the last path component in filename
// "scripts/[name].shader"
core::stringc cut ( filename );
core::stringc cut ( search.name );
s32 end = cut.findLast ( '/' );
s32 start = cut.findLast ( '/', end - 1 );
......@@ -1442,7 +1459,7 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN
}
else
{
loadFile = filename;
loadFile = search.name;
}
// already loaded the file ?
......@@ -1450,6 +1467,9 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN
if ( index >= 0 )
return 0;
// add file to loaded files
ShaderFile.push_back ( loadFile );
if ( !FileSystem->existFile ( loadFile.c_str () ) )
return 0;
......@@ -1461,9 +1481,6 @@ const quake3::SShader * CQ3LevelMesh::getShader ( const c8 * filename, s32 fileN
message = loadFile + " for " + core::stringc ( filename );
os::Printer::log("Loaded shader", message.c_str(), ELL_INFORMATION);
// add file to loaded files
ShaderFile.push_back ( loadFile );
// load script
core::array<u8> script;
const long len = file->getSize ();
......@@ -1772,6 +1789,12 @@ void CQ3LevelMesh::loadTextures2()
core::stringc check;
quake3::tTexArray textureArray;
// pre-load shaders
for ( t=0; t< NumTextures; ++t)
{
shader = getShader ( Textures[t].strName, 0 );
}
for ( t=0; t< NumTextures; ++t)
{
Tex[t].ShaderID = -1;
......
This diff is collapsed.
......@@ -63,18 +63,15 @@ private:
void vertextransform_wave ( f32 dt, quake3::SModifierFunction &function );
void vertextransform_bulge( f32 dt, quake3::SModifierFunction &function );
void vertextransform_autosprite( f32 dt, quake3::SModifierFunction &function );
void rgbgen ( f32 dt, quake3::SModifierFunction &function );
u32 tcgen ( f32 dt, quake3::SModifierFunction &function, core::matrix4 &texture );
void vertextransform_tcgen ( f32 dt, quake3::SModifierFunction &function );
void vertextransform_rgbgen ( f32 dt, quake3::SModifierFunction &function );
void transformtex ( const core::matrix4 &m, const u32 clamp );
f32 TimeAbs;
u32 animate( u32 stage, core::matrix4 &texture );
void animate( u32 stage, core::matrix4 &texture );
s32 PassedCulling;
s32 StageCall;
bool isTransparent ();
};
......
......@@ -1111,22 +1111,6 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE
taken = 1;
}
break;
case ESNRP_SHADER_0:
case ESNRP_SHADER_1:
case ESNRP_SHADER_2:
case ESNRP_SHADER_3:
case ESNRP_SHADER_4:
case ESNRP_SHADER_5:
case ESNRP_SHADER_6:
case ESNRP_SHADER_7:
case ESNRP_SHADER_8:
case ESNRP_SHADER_9:
case ESNRP_SHADER_10:
if ( !isCulled(node) )
{
ShaderNodeList[ time - ESNRP_SHADER_0].push_back( ShaderNodeEntry ( node,time - ESNRP_SHADER_0 ));
taken = 1;
} break;
case ESNRP_COUNT: // ignore this one
break;
......@@ -1265,23 +1249,6 @@ void CSceneManager::drawAll()
TransparentNodeList.set_used(0);
}
// render shader objects.
{
for ( u32 g = 0; g!= ESNRP_SHADER_10 - ESNRP_SHADER_0 + 1; ++g )
{
CurrentRendertime = (scene::E_SCENE_NODE_RENDER_PASS) (ESNRP_SHADER_0 + g);
const u32 size = ShaderNodeList[g].size ();
if ( 0 == size )
continue;
ShaderNodeList[g].sort(); // sort by textures
for (i=0; i< size; ++i)
ShaderNodeList[g][i].node->render();
ShaderNodeList[g].set_used(0);
}
}
clearDeletionList();
......
......@@ -483,26 +483,6 @@ namespace scene
}
};
struct ShaderNodeEntry
{
ShaderNodeEntry() {};
ShaderNodeEntry(ISceneNode* n, u32 sceneTime )
{
textureValue = n->getMaterial( sceneTime ).getTexture(0);
node = n;
}
ISceneNode* node;
void* textureValue;
bool operator < (const ShaderNodeEntry& other) const
{
return (textureValue < other.textureValue);
}
};
struct TransparentNodeEntry
{
......@@ -579,7 +559,6 @@ namespace scene
core::array<ISceneNode*> SkyBoxList;
core::array<DefaultNodeEntry> SolidNodeList;
core::array<TransparentNodeEntry> TransparentNodeList;
core::array<ShaderNodeEntry> ShaderNodeList[ ESNRP_SHADER_10 - ESNRP_SHADER_0 + 1];
core::array<IMeshLoader*> MeshLoaderList;
core::array<ISceneNode*> DeletionList;
......
......@@ -383,10 +383,9 @@ void CShadowVolumeSceneNode::setMeshToRenderFrom(const IMesh* mesh)
void CShadowVolumeSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, scene::ESNRP_SHADOW);
ISceneNode::OnRegisterSceneNode();
}
}
......
......@@ -206,10 +206,9 @@ const core::aabbox3d<f32>& CSkyBoxSceneNode::getBoundingBox() const
void CSkyBoxSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, ESNRP_SKY_BOX);
ISceneNode::OnRegisterSceneNode();
}
}
......
......@@ -142,10 +142,9 @@ const core::aabbox3d<f32>& CSkyDomeSceneNode::getBoundingBox() const
void CSkyDomeSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, ESNRP_SKY_BOX);
ISceneNode::OnRegisterSceneNode();
}
}
......
......@@ -21,21 +21,21 @@ class CSoftware2MaterialRenderer : public IMaterialRenderer
public:
//! Constructor
CSoftware2MaterialRenderer(video::CSoftwareDriver2* driver)
CSoftware2MaterialRenderer(video::CBurningVideoDriver* driver)
: Driver(driver)
{
}
protected:
video::CSoftwareDriver2* Driver;
video::CBurningVideoDriver* Driver;
};
//! solid material renderer
class CSoftware2MaterialRenderer_SOLID : public CSoftware2MaterialRenderer
{
public:
CSoftware2MaterialRenderer_SOLID ( video::CSoftwareDriver2* driver )
CSoftware2MaterialRenderer_SOLID ( video::CBurningVideoDriver* driver )
:CSoftware2MaterialRenderer ( driver ) {}
//! Returns if the material is transparent.
......@@ -52,7 +52,7 @@ public:
class CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR : public CSoftware2MaterialRenderer
{
public:
CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR ( video::CSoftwareDriver2* driver )
CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR ( video::CBurningVideoDriver* driver )
: CSoftware2MaterialRenderer ( driver ) {}
......@@ -68,13 +68,48 @@ public:
class CSoftware2MaterialRenderer_UNSUPPORTED : public CSoftware2MaterialRenderer
{
public:
CSoftware2MaterialRenderer_UNSUPPORTED ( video::CSoftwareDriver2* driver )
CSoftware2MaterialRenderer_UNSUPPORTED ( video::CBurningVideoDriver* driver )
: CSoftware2MaterialRenderer ( driver ) {}
virtual s32 getRenderCapability() const { return 1; }
};
//! unsupported material renderer
class CBurningShader_REFERENCE : public CSoftware2MaterialRenderer
{
public:
CBurningShader_REFERENCE ( video::CBurningVideoDriver* driver )
: CSoftware2MaterialRenderer ( driver ) {}
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices* services)
{
}
virtual void OnUnsetMaterial()
{
}
virtual bool isTransparent() const
{
return false;
}
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
{
return true;
};
virtual s32 getRenderCapability() const
{
return 1;
}
};
} // end namespace video
} // end namespace irr
......
This diff is collapsed.
......@@ -16,15 +16,15 @@ namespace irr
{
namespace video
{
class CSoftwareDriver2 : public CNullDriver
class CBurningVideoDriver : public CNullDriver
{
public:
//! constructor
CSoftwareDriver2(const core::dimension2d<s32>& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter);
CBurningVideoDriver(const core::dimension2d<s32>& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter);
//! destructor
virtual ~CSoftwareDriver2();
virtual ~CBurningVideoDriver();
//! presents the rendered scene on the screen, returns false if failed
virtual bool endScene( s32 windowId = 0, core::rect<s32>* sourceRect=0 );
......@@ -124,7 +124,7 @@ namespace video
void setRenderTarget(video::CImage* image);
//! sets the current Texture
bool setTexture(u32 stage, video::ITexture* texture);
//bool setTexture(u32 stage, video::ITexture* texture);
//! returns a device dependent texture from a software surface (IImage)
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
......@@ -145,8 +145,6 @@ namespace video
IDepthBuffer* DepthBuffer;
video::ITexture* Texture[2];
sInternalTexture Texmap[2];
/*
extend Matrix Stack
......@@ -215,37 +213,8 @@ namespace video
void select_polygon_mipmap2 ( s4DVertex **source, s32 tex ) const;
sVec4 Global_AmbientLight;
struct SInternalLight
{
SLight org;
sVec4 posEyeSpace;
f32 constantAttenuation;
f32 linearAttenuation;
f32 quadraticAttenuation;
sVec4 AmbientColor;
sVec4 DiffuseColor;
sVec4 SpecularColor;
};
core::array<SInternalLight> Light;
struct SInternalMaterial
{
SMaterial org;
sVec4 AmbientColor;
sVec4 DiffuseColor;
sVec4 SpecularColor;
sVec4 EmissiveColor;
u32 SpecularEnabled; // == Power2
};
SInternalMaterial Material;
SBurningShaderLightSpace LightSpace;
SBurningShaderMaterial Material;
static const sVec4 NDCPlane[6];
......
......@@ -37,14 +37,14 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const char* name, bool gener
if ( origSize == optSize )
{
MipMap[0] = new CImage(ECF_SOFTWARE2, image);
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, image);
}
else
{
MipMap[0] = new CImage(ECF_SOFTWARE2, optSize);
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, optSize);
// temporary CImage needed
CImage * temp = new CImage ( ECF_SOFTWARE2, image );
CImage * temp = new CImage ( BURNINGSHADER_COLOR_FORMAT, image );
temp->copyToScaling(MipMap[0]);
temp->drop ();
}
......@@ -108,7 +108,7 @@ void CSoftwareTexture2::regenerateMipMapLevels()
newSize.Width = core::s32_max ( 1, currentSize.Width >> 1 );
newSize.Height = core::s32_max ( 1, currentSize.Height >> 1 );
MipMap[i] = new CImage(ECF_SOFTWARE2, newSize);
MipMap[i] = new CImage(BURNINGSHADER_COLOR_FORMAT, newSize);
MipMap[0]->copyToScalingBoxFilter ( MipMap[i], 0 );
c = MipMap[i];
i += 1;
......
......@@ -48,7 +48,7 @@ public:
}
//! Returns the size of the largest mipmap.
const core::dimension2d<s32>& getMaxSize() const
const core::dimension2d<s32>& getMaxMipMapSize() const
{
return MipMap[0]->getDimension();
}
......@@ -81,7 +81,7 @@ public:
//! returns color format of texture
virtual ECOLOR_FORMAT getColorFormat() const
{
return ECF_SOFTWARE2;
return BURNINGSHADER_COLOR_FORMAT;
}
//! returns pitch of texture (in bytes)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -144,10 +144,7 @@ void CTRTextureBlend::scanline_bilinear ()
sVec4 slopeC;
#endif
#ifdef IPOL_T0
sVec2 slopeT0;
#endif
#ifdef IPOL_T1
sVec2 slopeT1;
sVec2 slopeT[MATERIAL_MAX_TEXTURES];
#endif
// apply top-left fill-convention, left
......@@ -172,10 +169,10 @@ void CTRTextureBlend::scanline_bilinear ()
slopeC = (line.c[1] - line.c[0]) * invDeltaX;
#endif
#ifdef IPOL_T0
slopeT0 = (line.t0[1] - line.t0[0]) * invDeltaX;
slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX;
#endif
#ifdef IPOL_T1
slopeT1 = (line.t1[1] - line.t1[0]) * invDeltaX;
slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX;
#endif
#ifdef SUBTEXEL
......@@ -190,17 +187,17 @@ void CTRTextureBlend::scanline_bilinear ()
line.c[0] += slopeC * subPixel;
#endif
#ifdef IPOL_T0
line.t0[0] += slopeT0 * subPixel;
line.t[0][0] += slopeT[0] * subPixel;
#endif
#ifdef IPOL_T1
line.t1[0] += slopeT1 * subPixel;
line.t[1][0] += slopeT[1] * subPixel;
#endif
#endif
dst = lockedSurface + ( line.y * SurfaceWidth ) + xStart;
dst = lockedSurface + ( line.y * RenderTarget->getDimension().Width ) + xStart;
#ifdef USE_ZBUFFER
z = lockedZBuffer + ( line.y * SurfaceWidth ) + xStart;
z = lockedDepthBuffer + ( line.y * RenderTarget->getDimension().Width ) + xStart;
#endif
......@@ -232,8 +229,8 @@ void CTRTextureBlend::scanline_bilinear ()
getSample_texture ( r0, g0, b0,
&IT[0],
f32_to_fixPoint ( line.t0[0].x,inversew),
f32_to_fixPoint ( line.t0[0].y,inversew)
f32_to_fixPoint ( line.t[0][0].x,inversew),
f32_to_fixPoint ( line.t[0][0].y,inversew)
);
color_to_fix ( r1, g1, b1, dst[i] );
......@@ -248,7 +245,7 @@ void CTRTextureBlend::scanline_bilinear ()
line.w[0] += slopeW;
#endif
#ifdef IPOL_T0
line.t0[0] += slopeT0;
line.t[0][0] += slopeT[0];
#endif
}
break;
......@@ -271,8 +268,8 @@ void CTRTextureBlend::scanline_bilinear ()
#endif
getSample_texture ( r0, g0, b0,
&IT[0],
f32_to_fixPoint ( line.t0[0].x,inversew),
f32_to_fixPoint ( line.t0[0].y,inversew)
f32_to_fixPoint ( line.t[0][0].x,inversew),
f32_to_fixPoint ( line.t[0][0].y,inversew)
);
color_to_fix ( r1, g1, b1, dst[i] );
......@@ -287,7 +284,7 @@ void CTRTextureBlend::scanline_bilinear ()
line.w[0] += slopeW;
#endif
#ifdef IPOL_T0
line.t0[0] += slopeT0;
line.t[0][0] += slopeT[0];
#endif
}break;
} // zcompare
......@@ -342,13 +339,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.slopeT0[0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0];
scan.t0[0] = a->Tex[0];
scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0];
scan.t[0][0] = a->Tex[0];
#endif
#ifdef IPOL_T1
scan.slopeT1[0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0];
scan.t1[0] = a->Tex[1];
scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0];
scan.t[1][0] = a->Tex[1];
#endif
// top left fill convention y run
......@@ -362,7 +359,7 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
lockedSurface = (tVideoSample*)RenderTarget->lock();
#ifdef USE_ZBUFFER
lockedZBuffer = ZBuffer->lock();
lockedDepthBuffer = (fp24*) DepthBuffer->lock();
#endif
#ifdef IPOL_T0
......@@ -396,13 +393,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.slopeT0[1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1];
scan.t0[1] = a->Tex[0];
scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1];
scan.t[0][1] = a->Tex[0];
#endif
#ifdef IPOL_T1
scan.slopeT1[1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1];
scan.t1[1] = a->Tex[1];
scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1];
scan.t[1][1] = a->Tex[1];
#endif
// apply top-left fill convention, top part
......@@ -432,13 +429,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.t0[0] += scan.slopeT0[0] * subPixel;
scan.t0[1] += scan.slopeT0[1] * subPixel;
scan.t[0][0] += scan.slopeT[0][0] * subPixel;
scan.t[0][1] += scan.slopeT[0][1] * subPixel;
#endif
#ifdef IPOL_T1
scan.t1[0] += scan.slopeT1[0] * subPixel;
scan.t1[1] += scan.slopeT1[1] * subPixel;
scan.t[1][0] += scan.slopeT[1][0] * subPixel;
scan.t[1][1] += scan.slopeT[1][1] * subPixel;
#endif
#endif
......@@ -465,13 +462,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
line.t0[scan.left] = scan.t0[0];
line.t0[scan.right] = scan.t0[1];
line.t[0][scan.left] = scan.t[0][0];
line.t[0][scan.right] = scan.t[0][1];
#endif
#ifdef IPOL_T1
line.t1[scan.left] = scan.t1[0];
line.t1[scan.right] = scan.t1[1];
line.t[1][scan.left] = scan.t[1][0];
line.t[1][scan.right] = scan.t[1][1];
#endif
// render a scanline
......@@ -496,13 +493,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.t0[0] += scan.slopeT0[0];
scan.t0[1] += scan.slopeT0[1];
scan.t[0][0] += scan.slopeT[0][0];
scan.t[0][1] += scan.slopeT[0][1];
#endif
#ifdef IPOL_T1
scan.t1[0] += scan.slopeT1[0];
scan.t1[1] += scan.slopeT1[1];
scan.t[1][0] += scan.slopeT[1][0];
scan.t[1][1] += scan.slopeT[1][1];
#endif
}
......@@ -527,10 +524,10 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
scan.c[0] = a->Color[0] + scan.slopeC[0] * temp[0];
#endif
#ifdef IPOL_T0
scan.t0[0] = a->Tex[0] + scan.slopeT0[0] * temp[0];
scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0];
#endif
#ifdef IPOL_T1
scan.t1[0] = a->Tex[1] + scan.slopeT1[0] * temp[0];
scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0];
#endif
}
......@@ -555,13 +552,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.slopeT0[1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2];
scan.t0[1] = b->Tex[0];
scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2];
scan.t[0][1] = b->Tex[0];
#endif
#ifdef IPOL_T1
scan.slopeT1[1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2];
scan.t1[1] = b->Tex[1];
scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2];
scan.t[1][1] = b->Tex[1];
#endif
// apply top-left fill convention, top part
......@@ -592,13 +589,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.t0[0] += scan.slopeT0[0] * subPixel;
scan.t0[1] += scan.slopeT0[1] * subPixel;
scan.t[0][0] += scan.slopeT[0][0] * subPixel;
scan.t[0][1] += scan.slopeT[0][1] * subPixel;
#endif
#ifdef IPOL_T1
scan.t1[0] += scan.slopeT1[0] * subPixel;
scan.t1[1] += scan.slopeT1[1] * subPixel;
scan.t[1][0] += scan.slopeT[1][0] * subPixel;
scan.t[1][1] += scan.slopeT[1][1] * subPixel;
#endif
#endif
......@@ -625,13 +622,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
line.t0[scan.left] = scan.t0[0];
line.t0[scan.right] = scan.t0[1];
line.t[0][scan.left] = scan.t[0][0];
line.t[0][scan.right] = scan.t[0][1];
#endif
#ifdef IPOL_T1
line.t1[scan.left] = scan.t1[0];
line.t1[scan.right] = scan.t1[1];
line.t[1][scan.left] = scan.t[1][0];
line.t[1][scan.right] = scan.t[1][1];
#endif
// render a scanline
......@@ -656,13 +653,13 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
#endif
#ifdef IPOL_T0
scan.t0[0] += scan.slopeT0[0];
scan.t0[1] += scan.slopeT0[1];
scan.t[0][0] += scan.slopeT[0][0];
scan.t[0][1] += scan.slopeT[0][1];
#endif
#ifdef IPOL_T1
scan.t1[0] += scan.slopeT1[0];
scan.t1[1] += scan.slopeT1[1];
scan.t[1][0] += scan.slopeT[1][0];
scan.t[1][1] += scan.slopeT[1][1];
#endif
}
......@@ -671,7 +668,7 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
RenderTarget->unlock();
#ifdef USE_ZBUFFER
ZBuffer->unlock();
DepthBuffer->unlock();
#endif
#ifdef IPOL_T0
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -115,8 +115,8 @@ static inline void swap_xor ( s32 &a, s32 &b )
void CTRTextureWire2::renderLine ( const s4DVertex *a,const s4DVertex *b ) const
{
int pitch0 = SurfaceWidth << VIDEO_SAMPLE_GRANULARITY;
int pitch1 = SurfaceWidth << 2;
int pitch0 = RenderTarget->getDimension().Width << VIDEO_SAMPLE_GRANULARITY;
int pitch1 = RenderTarget->getDimension().Width << 2;
int aposx = (int) a->Pos.x;
int aposy = (int) a->Pos.y;
......@@ -171,7 +171,7 @@ void CTRTextureWire2::renderLine ( const s4DVertex *a,const s4DVertex *b ) const
dst = (tVideoSample*) ( (u8*) lockedSurface + ( aposy * pitch0 ) + (aposx << VIDEO_SAMPLE_GRANULARITY ) );
#ifdef USE_ZBUFFER
z = (fp24*) ( (u8*) lockedZBuffer + ( aposy * pitch1 ) + (aposx << 2 ) );
z = (fp24*) ( (u8*) lockedDepthBuffer + ( aposy * pitch1 ) + (aposx << 2 ) );
#endif
c = dx << 1;
......@@ -254,7 +254,7 @@ void CTRTextureWire2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
lockedSurface = (tVideoSample*)RenderTarget->lock();
#ifdef USE_ZBUFFER
lockedZBuffer = ZBuffer->lock();
lockedDepthBuffer = (fp24*) DepthBuffer->lock();
#endif
renderLine ( a, b );
......@@ -264,7 +264,7 @@ void CTRTextureWire2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
RenderTarget->unlock();
#ifdef USE_ZBUFFER
ZBuffer->unlock();
DepthBuffer->unlock();
#endif
}
......@@ -281,14 +281,14 @@ void CTRTextureWire2::drawLine ( const s4DVertex *a,const s4DVertex *b)
lockedSurface = (tVideoSample*)RenderTarget->lock();
#ifdef USE_ZBUFFER
lockedZBuffer = ZBuffer->lock();
lockedDepthBuffer = (fp24*) DepthBuffer->lock();
#endif
renderLine ( a, b );
RenderTarget->unlock();
#ifdef USE_ZBUFFER
ZBuffer->unlock();
DepthBuffer->unlock();
#endif
}
......
......@@ -46,10 +46,9 @@ CTextSceneNode::~CTextSceneNode()
void CTextSceneNode::OnRegisterSceneNode()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, ESNRP_TRANSPARENT);
ISceneNode::OnRegisterSceneNode();
}
}
//! renders the node.
......@@ -101,11 +100,11 @@ CBillboardTextSceneNode::CBillboardTextSceneNode(ISceneNode* parent, ISceneManag
setDebugName("CBillboardTextSceneNode");
#endif
Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
Material.MaterialTypeParam = 0.5f;
Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
Material.MaterialTypeParam = 1.f / 255.f;
Material.BackfaceCulling = false;
Material.Lighting = false;
Material.ZBuffer = false;
Material.ZBuffer = true;
Material.ZWriteEnable = false;
if (font)
......
......@@ -1420,8 +1420,6 @@ bool CXMeshFileLoader::parseDataObjectAnimation()
{
ISkinnedMesh::SPositionKey *key=&animationDump.PositionKeys[n];
//key->position+=joint->LocalMatrix.getTranslation();
joint->PositionKeys.push_back(*key);
}
......
......@@ -23,17 +23,19 @@ namespace video
};
IBurningShader::IBurningShader(IDepthBuffer* zbuffer)
:RenderTarget(0),ZBuffer(zbuffer)
:RenderTarget(0),DepthBuffer(zbuffer)
{
IT[0].Texture = 0;
IT[1].Texture = 0;
#ifdef _DEBUG
setDebugName("CTRTextureLightMap2_M1");
setDebugName("IBurningShader");
#endif
if (ZBuffer)
zbuffer->grab();
for ( u32 i = 0; i != MATERIAL_MAX_TEXTURES; ++i )
{
IT[i].Texture = 0;
}
if ( DepthBuffer )
DepthBuffer->grab();
}
......@@ -43,14 +45,14 @@ namespace video
if (RenderTarget)
RenderTarget->drop();
if (ZBuffer)
ZBuffer->drop();
if ( IT[0].Texture )
IT[0].Texture->drop();
if (DepthBuffer)
DepthBuffer->drop();
if ( IT[1].Texture )
IT[1].Texture->drop();
for ( u32 i = 0; i != MATERIAL_MAX_TEXTURES; ++i )
{
if ( IT[i].Texture )
IT[i].Texture->drop();
}
}
//! sets a render target
......@@ -63,17 +65,23 @@ namespace video
if (RenderTarget)
{
SurfaceWidth = RenderTarget->getDimension().Width;
RenderTarget->grab();
//lockedSurface = (tVideoSample*)RenderTarget->lock();
//lockedDepthBuffer = DepthBuffer->lock();
}
}
//! sets the Texture
void IBurningShader::setTexture( u32 stage, video::CSoftwareTexture2* texture, s32 lodLevel)
void IBurningShader::setTextureParam( u32 stage, video::CSoftwareTexture2* texture, s32 lodLevel)
{
sInternalTexture *it = &IT[stage];
if ( it->Texture == texture )
return;
if ( it->Texture)
it->Texture->drop();
......@@ -95,10 +103,12 @@ namespace video
it->textureXMask = s32_to_fixPoint ( it->Texture->getSize().Width - 1 ) & FIX_POINT_UNSIGNED_MASK;
it->textureYMask = s32_to_fixPoint ( it->Texture->getSize().Height - 1 ) & FIX_POINT_UNSIGNED_MASK;
it->data = (tVideoSample*) it->Texture->lock();
}
}
} // end namespace video
} // end namespace irr
......
This diff is collapsed.
......@@ -30,10 +30,14 @@ namespace video
virtual const core::dimension2d<s32>& getSize() const = 0;
//! locks the zbuffer
virtual fp24* lock() = 0;
virtual void* lock() = 0;
//! unlocks the zbuffer
virtual void unlock() = 0;
//! returns pitch of depthbuffer (in bytes)
virtual u32 getPitch() const = 0;
};
......
......@@ -9,7 +9,7 @@ CppCompiler=-D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -D_USRDLL -DIR
Includes=..\..\include;zlib
Linker=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lopengl32_@@_
Libs=
UnitCount=592
UnitCount=593
Folders=doc,gui_impl,include,include/core,include/gui,include/io,include/scene,include/video,io_impl,other_impl,other_impl/extern,other_impl/extern/jpeglib,other_impl/extern/libpng,other_impl/extern/zlib,scene_impl,scene_impl/animators,scene_impl/collision,scene_impl/mesh,scene_impl/mesh/loaders,scene_impl/mesh/writers,scene_impl/nodes,scene_impl/nodes/particles,video_impl,"video_impl/Burning Video",video_impl/DirectX8,video_impl/DirectX9,video_impl/Null,video_impl/OpenGL,video_impl/Software
ObjFiles=
PrivateResource=
......@@ -5967,3 +5967,13 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit593]
FileName=CBurningShader_Raster_Reference.cpp
CompileCpp=1
Folder=video_impl/Burning Video
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -13,6 +13,7 @@
#include "SoftwareDriver2_compile_config.h"
#include "irrMath.h"
#include "CSoftwareTexture2.h"
#include "SMaterial.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment