Fixed the skybox textures orientation. They are now displayed non-flipped. Existing skybox textures have to be exchanged and rotated, though.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1011 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2007-09-28 23:10:53 +00:00
parent e7393eddc7
commit ced5e21846
7 changed files with 30 additions and 43 deletions

View File

@ -6,6 +6,8 @@ Changes in version 1.4 (... 2007)
- the base class for nearly all Irrlicht classes has been renamed from IUnknown to IReferenceCounted
- Fixed Skybox texture orientations. They are now displayed non-flipped. Existing skyboxes have to be changed, though. Echange left and right texture and rotate up-texture 270 degrees clockwise, and down-texture 90 degrees clockwise. Textures from Terragen and other tools can be used directly, now.
- Added ITexture::isRenderTarget()
- Added STL mesh file format reader and writer.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -55,11 +55,9 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|/ | / | //|
0---------1/ | // |
-1-1-1 1-1-1 |// |
0--------1
0--------1
*/
f32 onepixel = 0.0f;
video::ITexture* tex = front;
if (!tex) tex = left;
if (!tex) tex = back;
@ -67,57 +65,54 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
if (!tex) tex = top;
if (!tex) tex = bottom;
if (tex)
{
core::dimension2d<s32> dim = tex->getSize();
onepixel = 1.0f / (dim.Width * 1.5f);
}
const f32 onepixel = tex?(1.0f / (tex->getSize().Width * 1.5f)) : 0.0f;
const f32 l = 10.0f;
const f32 t = 1.0f - onepixel;
const f32 o = 0.0f + onepixel;
f32 l = 10.0f;
f32 t = 1.0f - onepixel;
f32 o = 0.0f + onepixel;
// create front side
Material[0] = mat;
Material[0].setTexture(0, front);
Vertices[0] = video::S3DVertex(-l,-l,-l, 0,0,1, video::SColor(255,255,255,255), o, t);
Vertices[1] = video::S3DVertex( l,-l,-l, 0,0,1, video::SColor(255,255,255,255), t, t);
Vertices[2] = video::S3DVertex( l, l,-l, 0,0,1, video::SColor(255,255,255,255), t, o);
Vertices[3] = video::S3DVertex(-l, l,-l, 0,0,1, video::SColor(255,255,255,255), o, o);
Vertices[0] = video::S3DVertex(-l,-l,-l, 0,0,1, video::SColor(255,255,255,255), t, t);
Vertices[1] = video::S3DVertex( l,-l,-l, 0,0,1, video::SColor(255,255,255,255), o, t);
Vertices[2] = video::S3DVertex( l, l,-l, 0,0,1, video::SColor(255,255,255,255), o, o);
Vertices[3] = video::S3DVertex(-l, l,-l, 0,0,1, video::SColor(255,255,255,255), t, o);
// create left side
Material[1] = mat;
Material[1].setTexture(0, left);
Vertices[4] = video::S3DVertex( l,-l,-l, -1,0,0, video::SColor(255,255,255,255), o, t);
Vertices[5] = video::S3DVertex( l,-l, l, -1,0,0, video::SColor(255,255,255,255), t, t);
Vertices[6] = video::S3DVertex( l, l, l, -1,0,0, video::SColor(255,255,255,255), t, o);
Vertices[7] = video::S3DVertex( l, l,-l, -1,0,0, video::SColor(255,255,255,255), o, o);
Vertices[4] = video::S3DVertex( l,-l,-l, -1,0,0, video::SColor(255,255,255,255), t, t);
Vertices[5] = video::S3DVertex( l,-l, l, -1,0,0, video::SColor(255,255,255,255), o, t);
Vertices[6] = video::S3DVertex( l, l, l, -1,0,0, video::SColor(255,255,255,255), o, o);
Vertices[7] = video::S3DVertex( l, l,-l, -1,0,0, video::SColor(255,255,255,255), t, o);
// create back side
Material[2] = mat;
Material[2].setTexture(0, back);
Vertices[8] = video::S3DVertex( l,-l, l, 0,0,-1, video::SColor(255,255,255,255), o, t);
Vertices[9] = video::S3DVertex(-l,-l, l, 0,0,-1, video::SColor(255,255,255,255), t, t);
Vertices[10] = video::S3DVertex(-l, l, l, 0,0,-1, video::SColor(255,255,255,255), t, o);
Vertices[11] = video::S3DVertex( l, l, l, 0,0,-1, video::SColor(255,255,255,255), o, o);
Vertices[8] = video::S3DVertex( l,-l, l, 0,0,-1, video::SColor(255,255,255,255), t, t);
Vertices[9] = video::S3DVertex(-l,-l, l, 0,0,-1, video::SColor(255,255,255,255), o, t);
Vertices[10] = video::S3DVertex(-l, l, l, 0,0,-1, video::SColor(255,255,255,255), o, o);
Vertices[11] = video::S3DVertex( l, l, l, 0,0,-1, video::SColor(255,255,255,255), t, o);
// create right side
Material[3] = mat;
Material[3].setTexture(0, right);
Vertices[12] = video::S3DVertex(-l,-l, l, 1,0,0, video::SColor(255,255,255,255), o, t);
Vertices[13] = video::S3DVertex(-l,-l,-l, 1,0,0, video::SColor(255,255,255,255), t, t);
Vertices[14] = video::S3DVertex(-l, l,-l, 1,0,0, video::SColor(255,255,255,255), t, o);
Vertices[15] = video::S3DVertex(-l, l, l, 1,0,0, video::SColor(255,255,255,255), o, o);
Vertices[12] = video::S3DVertex(-l,-l, l, 1,0,0, video::SColor(255,255,255,255), t, t);
Vertices[13] = video::S3DVertex(-l,-l,-l, 1,0,0, video::SColor(255,255,255,255), o, t);
Vertices[14] = video::S3DVertex(-l, l,-l, 1,0,0, video::SColor(255,255,255,255), o, o);
Vertices[15] = video::S3DVertex(-l, l, l, 1,0,0, video::SColor(255,255,255,255), t, o);
// create top side
Material[4] = mat;
Material[4].setTexture(0, top);
Vertices[16] = video::S3DVertex( l, l, l, 0,-1,0, video::SColor(255,255,255,255), o, o);
Vertices[16] = video::S3DVertex( l, l, l, 0,-1,0, video::SColor(255,255,255,255), t, t);
Vertices[17] = video::S3DVertex(-l, l, l, 0,-1,0, video::SColor(255,255,255,255), o, t);
Vertices[18] = video::S3DVertex(-l, l,-l, 0,-1,0, video::SColor(255,255,255,255), t, t);
Vertices[18] = video::S3DVertex(-l, l,-l, 0,-1,0, video::SColor(255,255,255,255), o, o);
Vertices[19] = video::S3DVertex( l, l,-l, 0,-1,0, video::SColor(255,255,255,255), t, o);
// create bottom side
@ -125,16 +120,9 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
Material[5] = mat;
Material[5].setTexture(0, bottom);
Vertices[20] = video::S3DVertex(-l,-l, l, 0,1,0, video::SColor(255,255,255,255), o, o);
Vertices[21] = video::S3DVertex( l,-l, l, 0,1,0, video::SColor(255,255,255,255), o, t);
Vertices[21] = video::S3DVertex( l,-l, l, 0,1,0, video::SColor(255,255,255,255), t, o);
Vertices[22] = video::S3DVertex( l,-l,-l, 0,1,0, video::SColor(255,255,255,255), t, t);
Vertices[23] = video::S3DVertex(-l,-l,-l, 0,1,0, video::SColor(255,255,255,255), t, o);
}
//! destructor
CSkyBoxSceneNode::~CSkyBoxSceneNode()
{
Vertices[23] = video::S3DVertex(-l,-l,-l, 0,1,0, video::SColor(255,255,255,255), o, t);
}
@ -254,7 +242,7 @@ ISceneNode* CSkyBoxSceneNode::clone(ISceneNode* newParent, ISceneManager* newMan
nb->cloneMembers(this, newManager);
for (int i=0; i<6; ++i)
for (u32 i=0; i<6; ++i)
nb->Material[i] = Material[i];
nb->drop();

View File

@ -13,7 +13,7 @@ namespace irr
namespace scene
{
// Skybox, rendererd with zbuffer turned off, before all other nodes.
// Skybox, rendered with zbuffer turned off, before all other nodes.
class CSkyBoxSceneNode : public ISceneNode
{
public:
@ -23,9 +23,6 @@ namespace scene
video::ITexture* right, video::ITexture* front, video::ITexture* back,
ISceneNode* parent, ISceneManager* mgr, s32 id);
//! destructor
virtual ~CSkyBoxSceneNode();
virtual void OnRegisterSceneNode();
//! renders the node.