Merged 1486-1488 from 1.4 branch, IImage methods exposed and MeshManipulator moved.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1489 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2008-08-13 23:48:33 +00:00
parent ed1cd4ea1e
commit 565fc47062
10 changed files with 226 additions and 156 deletions

View File

@ -7,6 +7,7 @@
#include "IReferenceCounted.h" #include "IReferenceCounted.h"
#include "position2d.h" #include "position2d.h"
#include "rect.h"
#include "SColor.h" #include "SColor.h"
namespace irr namespace irr
@ -43,9 +44,6 @@ class IImage : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IImage() {}
//! Lock function. Use this to get a pointer to the image data. //! Lock function. Use this to get a pointer to the image data.
/** After you don't need the pointer anymore, you must call unlock(). /** After you don't need the pointer anymore, you must call unlock().
\return Pointer to the image data. What type of data is pointed to \return Pointer to the image data. What type of data is pointed to
@ -96,13 +94,27 @@ public:
virtual u32 getAlphaMask() const = 0; virtual u32 getAlphaMask() const = 0;
//! Returns pitch of image //! Returns pitch of image
virtual u32 getPitch() const = 0; virtual u32 getPitch() const =0;
//! Copies the image into the target, scaling the image to fit //! Copies the image into the target, scaling the image to fit
virtual void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) = 0; virtual void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) =0;
//! Copies the image into the target, scaling the image to fit //! Copies the image into the target, scaling the image to fit
virtual void copyToScaling(IImage* target) = 0; virtual void copyToScaling(IImage* target) =0;
//! copies this surface into another
virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)) =0;
//! copies this surface into another
virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0) =0;
//! copies this surface into another, using the alpha mask, an cliprect and a color to add with
virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const SColor &color,
const core::rect<s32>* clipRect = 0) =0;
//! fills the surface with black or white
virtual void fill(const SColor &color) =0;
}; };

View File

@ -29,6 +29,7 @@ namespace io
namespace scene namespace scene
{ {
class IMeshBuffer; class IMeshBuffer;
class IMeshManipulator;
} // end namespace scene } // end namespace scene
namespace video namespace video
@ -781,6 +782,35 @@ namespace video
bool ownForeignMemory=false, bool ownForeignMemory=false,
bool deleteMemory = true) = 0; bool deleteMemory = true) = 0;
//! Creates an empty software image.
/**
\param format Desired color format of the image.
\param size Size of the image to create.
\return The created image.
If you no longer need the image, you should call IImage::drop().
See IReferenceCounted::drop() for more information. */
virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<s32>& size) =0;
//! Creates a software image by converting it to given format from another image.
/**
\param format Desired color format of the image.
\param imageToCopy Image to copy to the new image.
\return The created image.
If you no longer need the image, you should call IImage::drop().
See IReferenceCounted::drop() for more information. */
virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy) =0;
//! Creates a software image from a part of another image.
/**
\param imageToCopy Image to copy the the new image in part.
\param pos Position of rectangle to copy.
\param size Extents of rectangle to copy.
\return The created image.
If you no longer need the image, you should call IImage::drop().
See IReferenceCounted::drop() for more information. */
virtual IImage* createImage(IImage* imageToCopy,
const core::position2d<s32>& pos, const core::dimension2d<s32>& size) =0;
//! Event handler for resize events. Only used by the engine internally. //! Event handler for resize events. Only used by the engine internally.
/** Used to notify the driver that the window was resized. /** Used to notify the driver that the window was resized.
Usually, there is no need to call this method. */ Usually, there is no need to call this method. */
@ -875,6 +905,9 @@ namespace video
Software driver and the Null driver will always return 0. */ Software driver and the Null driver will always return 0. */
virtual IGPUProgrammingServices* getGPUProgrammingServices() = 0; virtual IGPUProgrammingServices* getGPUProgrammingServices() = 0;
//! Returns a pointer to the mesh manipulator.
virtual scene::IMeshManipulator* getMeshManipulator() = 0;
//! Clears the ZBuffer. //! Clears the ZBuffer.
/** Note that you usually need not to call this method, as it /** Note that you usually need not to call this method, as it
is automatically done in IVideoDriver::beginScene() or is automatically done in IVideoDriver::beginScene() or

View File

@ -54,7 +54,7 @@ namespace irr
CLIPCODE_RIGHT = 8 CLIPCODE_RIGHT = 8
}; };
inline u32 GetClipCode ( const AbsRectangle &r, const core::position2d<s32> &p ) inline u32 GetClipCode( const AbsRectangle &r, const core::position2d<s32> &p )
{ {
u32 code = CLIPCODE_EMPTY; u32 code = CLIPCODE_EMPTY;
@ -79,7 +79,7 @@ inline u32 GetClipCode ( const AbsRectangle &r, const core::position2d<s32> &p )
@return: 1 if valid @return: 1 if valid
*/ */
static int ClipLine (const AbsRectangle &clipping, static int ClipLine(const AbsRectangle &clipping,
core::position2d<s32> &p0, core::position2d<s32> &p0,
core::position2d<s32> &p1, core::position2d<s32> &p1,
const core::position2d<s32>& p0_in, const core::position2d<s32>& p0_in,
@ -92,8 +92,8 @@ static int ClipLine (const AbsRectangle &clipping,
p0 = p0_in; p0 = p0_in;
p1 = p1_in; p1 = p1_in;
code0 = GetClipCode ( clipping, p0 ); code0 = GetClipCode( clipping, p0 );
code1 = GetClipCode ( clipping, p1 ); code1 = GetClipCode( clipping, p1 );
// trivial accepted // trivial accepted
while ( code0 | code1 ) while ( code0 | code1 )
@ -149,14 +149,14 @@ static int ClipLine (const AbsRectangle &clipping,
// modify first point // modify first point
p0.X = x; p0.X = x;
p0.Y = y; p0.Y = y;
code0 = GetClipCode ( clipping, p0 ); code0 = GetClipCode( clipping, p0 );
} }
else else
{ {
// modify second point // modify second point
p1.X = x; p1.X = x;
p1.Y = y; p1.Y = y;
code1 = GetClipCode ( clipping, p1 ); code1 = GetClipCode( clipping, p1 );
} }
} }
@ -289,7 +289,7 @@ static void RenderLine32_Blend(video::IImage *t,
run = dx; run = dx;
while ( run ) while ( run )
{ {
*dst = PixelBlend32 ( *dst, argb, alpha ); *dst = PixelBlend32( *dst, argb, alpha );
dst = (u32*) ( (u8*) dst + xInc ); // x += xInc dst = (u32*) ( (u8*) dst + xInc ); // x += xInc
d += m; d += m;
@ -306,7 +306,7 @@ static void RenderLine32_Blend(video::IImage *t,
/* /*
*/ */
static void RenderLine16_Decal (video::IImage *t, static void RenderLine16_Decal(video::IImage *t,
const core::position2d<s32> &p0, const core::position2d<s32> &p0,
const core::position2d<s32> &p1, const core::position2d<s32> &p1,
u32 argb ) u32 argb )
@ -371,7 +371,7 @@ static void RenderLine16_Decal (video::IImage *t,
/* /*
*/ */
static void RenderLine16_Blend (video::IImage *t, static void RenderLine16_Blend(video::IImage *t,
const core::position2d<s32> &p0, const core::position2d<s32> &p0,
const core::position2d<s32> &p1, const core::position2d<s32> &p1,
u32 argb, u32 argb,
@ -420,7 +420,7 @@ static void RenderLine16_Blend (video::IImage *t,
run = dx; run = dx;
while ( run ) while ( run )
{ {
*dst = PixelBlend16 ( *dst, argb, alpha ); *dst = PixelBlend16( *dst, argb, alpha );
dst = (u16*) ( (u8*) dst + xInc ); // x += xInc dst = (u16*) ( (u8*) dst + xInc ); // x += xInc
d += m; d += m;
@ -438,7 +438,7 @@ static void RenderLine16_Blend (video::IImage *t,
/*! /*!
*/ */
static void executeBlit_TextureCopy_x_to_x ( const SBlitJob * job ) static void executeBlit_TextureCopy_x_to_x( const SBlitJob * job )
{ {
const void *src = (void*) job->src; const void *src = (void*) job->src;
void *dst = (void*) job->dst; void *dst = (void*) job->dst;
@ -446,7 +446,7 @@ static void executeBlit_TextureCopy_x_to_x ( const SBlitJob * job )
const u32 widthPitch = job->width * job->dstPixelMul; const u32 widthPitch = job->width * job->dstPixelMul;
for ( s32 dy = 0; dy != job->height; ++dy ) for ( s32 dy = 0; dy != job->height; ++dy )
{ {
memcpy ( dst, src, widthPitch ); memcpy( dst, src, widthPitch );
src = (void*) ( (u8*) (src) + job->srcPitch ); src = (void*) ( (u8*) (src) + job->srcPitch );
dst = (void*) ( (u8*) (dst) + job->dstPitch ); dst = (void*) ( (u8*) (dst) + job->dstPitch );
@ -456,7 +456,7 @@ static void executeBlit_TextureCopy_x_to_x ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureCopy_32_to_16 ( const SBlitJob * job ) static void executeBlit_TextureCopy_32_to_16( const SBlitJob * job )
{ {
const u32 *src = static_cast<const u32*>(job->src); const u32 *src = static_cast<const u32*>(job->src);
u16 *dst = static_cast<u16*>(job->dst); u16 *dst = static_cast<u16*>(job->dst);
@ -466,8 +466,8 @@ static void executeBlit_TextureCopy_32_to_16 ( const SBlitJob * job )
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
//16 bit Blitter depends on pre-multiplied color //16 bit Blitter depends on pre-multiplied color
const u32 s = PixelLerp32 ( src[dx] | 0xFF000000, extractAlpha ( src[dx] ) ); const u32 s = PixelLerp32( src[dx] | 0xFF000000, extractAlpha( src[dx] ) );
dst[dx] = video::A8R8G8B8toA1R5G5B5 ( s ); dst[dx] = video::A8R8G8B8toA1R5G5B5( s );
} }
src = (u32*) ( (u8*) (src) + job->srcPitch ); src = (u32*) ( (u8*) (src) + job->srcPitch );
@ -477,7 +477,7 @@ static void executeBlit_TextureCopy_32_to_16 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureCopy_24_to_16 ( const SBlitJob * job ) static void executeBlit_TextureCopy_24_to_16( const SBlitJob * job )
{ {
const void *src = (void*) job->src; const void *src = (void*) job->src;
u16 *dst = (u16*) job->dst; u16 *dst = (u16*) job->dst;
@ -500,7 +500,7 @@ static void executeBlit_TextureCopy_24_to_16 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureCopy_16_to_32 ( const SBlitJob * job ) static void executeBlit_TextureCopy_16_to_32( const SBlitJob * job )
{ {
const u16 *src = (u16*) job->src; const u16 *src = (u16*) job->src;
u32 *dst = (u32*) job->dst; u32 *dst = (u32*) job->dst;
@ -509,7 +509,7 @@ static void executeBlit_TextureCopy_16_to_32 ( const SBlitJob * job )
{ {
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
dst[dx] = video::A1R5G5B5toA8R8G8B8 ( src[dx] ); dst[dx] = video::A1R5G5B5toA8R8G8B8( src[dx] );
} }
src = (u16*) ( (u8*) (src) + job->srcPitch ); src = (u16*) ( (u8*) (src) + job->srcPitch );
@ -519,7 +519,7 @@ static void executeBlit_TextureCopy_16_to_32 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureCopy_24_to_32 ( const SBlitJob * job ) static void executeBlit_TextureCopy_24_to_32( const SBlitJob * job )
{ {
void *src = (void*) job->src; void *src = (void*) job->src;
u32 *dst = (u32*) job->dst; u32 *dst = (u32*) job->dst;
@ -542,7 +542,7 @@ static void executeBlit_TextureCopy_24_to_32 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureBlend_16_to_16 ( const SBlitJob * job ) static void executeBlit_TextureBlend_16_to_16( const SBlitJob * job )
{ {
u32 dx; u32 dx;
s32 dy; s32 dy;
@ -552,7 +552,7 @@ static void executeBlit_TextureBlend_16_to_16 ( const SBlitJob * job )
const u32 rdx = job->width >> 1; const u32 rdx = job->width >> 1;
const u32 off = core::if_c_a_else_b ( job->width & 1 ,job->width - 1, 0 ); const u32 off = core::if_c_a_else_b( job->width & 1 ,job->width - 1, 0 );
if ( 0 == off ) if ( 0 == off )
@ -561,7 +561,7 @@ static void executeBlit_TextureBlend_16_to_16 ( const SBlitJob * job )
{ {
for ( dx = 0; dx != rdx; ++dx ) for ( dx = 0; dx != rdx; ++dx )
{ {
dst[dx] = PixelBlend16_simd ( dst[dx], src[dx] ); dst[dx] = PixelBlend16_simd( dst[dx], src[dx] );
} }
src = (u32*) ( (u8*) (src) + job->srcPitch ); src = (u32*) ( (u8*) (src) + job->srcPitch );
@ -575,10 +575,10 @@ static void executeBlit_TextureBlend_16_to_16 ( const SBlitJob * job )
{ {
for ( dx = 0; dx != rdx; ++dx ) for ( dx = 0; dx != rdx; ++dx )
{ {
dst[dx] = PixelBlend16_simd ( dst[dx], src[dx] ); dst[dx] = PixelBlend16_simd( dst[dx], src[dx] );
} }
((u16*) dst)[off] = PixelBlend16 ( ((u16*) dst)[off], ((u16*) src)[off] ); ((u16*) dst)[off] = PixelBlend16( ((u16*) dst)[off], ((u16*) src)[off] );
src = (u32*) ( (u8*) (src) + job->srcPitch ); src = (u32*) ( (u8*) (src) + job->srcPitch );
dst = (u32*) ( (u8*) (dst) + job->dstPitch ); dst = (u32*) ( (u8*) (dst) + job->dstPitch );
@ -589,7 +589,7 @@ static void executeBlit_TextureBlend_16_to_16 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureBlend_32_to_32 ( const SBlitJob * job ) static void executeBlit_TextureBlend_32_to_32( const SBlitJob * job )
{ {
u32 *src = (u32*) job->src; u32 *src = (u32*) job->src;
u32 *dst = (u32*) job->dst; u32 *dst = (u32*) job->dst;
@ -598,7 +598,7 @@ static void executeBlit_TextureBlend_32_to_32 ( const SBlitJob * job )
{ {
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
dst[dx] = PixelBlend32 ( dst[dx], src[dx] ); dst[dx] = PixelBlend32( dst[dx], src[dx] );
} }
src = (u32*) ( (u8*) (src) + job->srcPitch ); src = (u32*) ( (u8*) (src) + job->srcPitch );
dst = (u32*) ( (u8*) (dst) + job->dstPitch ); dst = (u32*) ( (u8*) (dst) + job->dstPitch );
@ -607,7 +607,7 @@ static void executeBlit_TextureBlend_32_to_32 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureBlendColor_16_to_16 ( const SBlitJob * job ) static void executeBlit_TextureBlendColor_16_to_16( const SBlitJob * job )
{ {
u16 *src = (u16*) job->src; u16 *src = (u16*) job->src;
u16 *dst = (u16*) job->dst; u16 *dst = (u16*) job->dst;
@ -617,7 +617,7 @@ static void executeBlit_TextureBlendColor_16_to_16 ( const SBlitJob * job )
{ {
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
dst[dx] = PixelBlend16 ( dst[dx], PixelMul16_2 ( src[dx], blend ) ); dst[dx] = PixelBlend16( dst[dx], PixelMul16_2( src[dx], blend ) );
} }
src = (u16*) ( (u8*) (src) + job->srcPitch ); src = (u16*) ( (u8*) (src) + job->srcPitch );
dst = (u16*) ( (u8*) (dst) + job->dstPitch ); dst = (u16*) ( (u8*) (dst) + job->dstPitch );
@ -627,7 +627,7 @@ static void executeBlit_TextureBlendColor_16_to_16 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_TextureBlendColor_32_to_32 ( const SBlitJob * job ) static void executeBlit_TextureBlendColor_32_to_32( const SBlitJob * job )
{ {
u32 *src = (u32*) job->src; u32 *src = (u32*) job->src;
u32 *dst = (u32*) job->dst; u32 *dst = (u32*) job->dst;
@ -636,7 +636,7 @@ static void executeBlit_TextureBlendColor_32_to_32 ( const SBlitJob * job )
{ {
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
dst[dx] = PixelBlend32 ( dst[dx], PixelMul32_2 ( src[dx], job->argb ) ); dst[dx] = PixelBlend32( dst[dx], PixelMul32_2( src[dx], job->argb ) );
} }
src = (u32*) ( (u8*) (src) + job->srcPitch ); src = (u32*) ( (u8*) (src) + job->srcPitch );
dst = (u32*) ( (u8*) (dst) + job->dstPitch ); dst = (u32*) ( (u8*) (dst) + job->dstPitch );
@ -645,18 +645,18 @@ static void executeBlit_TextureBlendColor_32_to_32 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_Color_16_to_16 ( const SBlitJob * job ) static void executeBlit_Color_16_to_16( const SBlitJob * job )
{ {
u16 *dst = (u16*) job->dst; u16 *dst = (u16*) job->dst;
u16 c0 = video::A8R8G8B8toA1R5G5B5 ( job->argb ); u16 c0 = video::A8R8G8B8toA1R5G5B5( job->argb );
u32 c = c0 | c0 << 16; u32 c = c0 | c0 << 16;
if ( 0 == (job->srcPitch & 3 ) ) if ( 0 == (job->srcPitch & 3 ) )
{ {
for ( s32 dy = 0; dy != job->height; ++dy ) for ( s32 dy = 0; dy != job->height; ++dy )
{ {
memset32 ( dst, c, job->srcPitch ); memset32( dst, c, job->srcPitch );
dst = (u16*) ( (u8*) (dst) + job->dstPitch ); dst = (u16*) ( (u8*) (dst) + job->dstPitch );
} }
} }
@ -666,7 +666,7 @@ static void executeBlit_Color_16_to_16 ( const SBlitJob * job )
for ( s32 dy = 0; dy != job->height; ++dy ) for ( s32 dy = 0; dy != job->height; ++dy )
{ {
memset32 ( dst, c, job->srcPitch ); memset32( dst, c, job->srcPitch );
dst[dx] = c0; dst[dx] = c0;
dst = (u16*) ( (u8*) (dst) + job->dstPitch ); dst = (u16*) ( (u8*) (dst) + job->dstPitch );
} }
@ -676,31 +676,31 @@ static void executeBlit_Color_16_to_16 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_Color_32_to_32 ( const SBlitJob * job ) static void executeBlit_Color_32_to_32( const SBlitJob * job )
{ {
u32 *dst = (u32*) job->dst; u32 *dst = (u32*) job->dst;
for ( s32 dy = 0; dy != job->height; ++dy ) for ( s32 dy = 0; dy != job->height; ++dy )
{ {
memset32 ( dst, job->argb, job->srcPitch ); memset32( dst, job->argb, job->srcPitch );
dst = (u32*) ( (u8*) (dst) + job->dstPitch ); dst = (u32*) ( (u8*) (dst) + job->dstPitch );
} }
} }
/*! /*!
*/ */
static void executeBlit_ColorAlpha_16_to_16 ( const SBlitJob * job ) static void executeBlit_ColorAlpha_16_to_16( const SBlitJob * job )
{ {
u16 *dst = (u16*) job->dst; u16 *dst = (u16*) job->dst;
const u32 alpha = extractAlpha ( job->argb ) >> 3; const u32 alpha = extractAlpha( job->argb ) >> 3;
const u32 src = video::A8R8G8B8toA1R5G5B5 ( job->argb ); const u32 src = video::A8R8G8B8toA1R5G5B5( job->argb );
for ( s32 dy = 0; dy != job->height; ++dy ) for ( s32 dy = 0; dy != job->height; ++dy )
{ {
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
dst[dx] = PixelBlend16 ( dst[dx], src, alpha ); dst[dx] = PixelBlend16( dst[dx], src, alpha );
} }
dst = (u16*) ( (u8*) (dst) + job->dstPitch ); dst = (u16*) ( (u8*) (dst) + job->dstPitch );
} }
@ -708,18 +708,18 @@ static void executeBlit_ColorAlpha_16_to_16 ( const SBlitJob * job )
/*! /*!
*/ */
static void executeBlit_ColorAlpha_32_to_32 ( const SBlitJob * job ) static void executeBlit_ColorAlpha_32_to_32( const SBlitJob * job )
{ {
u32 *dst = (u32*) job->dst; u32 *dst = (u32*) job->dst;
const u32 alpha = extractAlpha ( job->argb ); const u32 alpha = extractAlpha( job->argb );
const u32 src = job->argb; const u32 src = job->argb;
for ( s32 dy = 0; dy != job->height; ++dy ) for ( s32 dy = 0; dy != job->height; ++dy )
{ {
for ( s32 dx = 0; dx != job->width; ++dx ) for ( s32 dx = 0; dx != job->width; ++dx )
{ {
dst[dx] = PixelBlend32 ( dst[dx], src, alpha ); dst[dx] = PixelBlend32( dst[dx], src, alpha );
} }
dst = (u32*) ( (u8*) (dst) + job->dstPitch ); dst = (u32*) ( (u8*) (dst) + job->dstPitch );
} }
@ -727,16 +727,16 @@ static void executeBlit_ColorAlpha_32_to_32 ( const SBlitJob * job )
/*! /*!
*/ */
static tExecuteBlit getBlitter ( eBlitter operation,const video::IImage * dest,const video::IImage * source ) static tExecuteBlit getBlitter( eBlitter operation,const video::IImage * dest,const video::IImage * source )
{ {
video::ECOLOR_FORMAT sourceFormat = (video::ECOLOR_FORMAT) -1; video::ECOLOR_FORMAT sourceFormat = (video::ECOLOR_FORMAT) -1;
video::ECOLOR_FORMAT destFormat = (video::ECOLOR_FORMAT) -1; video::ECOLOR_FORMAT destFormat = (video::ECOLOR_FORMAT) -1;
if ( source ) if ( source )
sourceFormat = source->getColorFormat (); sourceFormat = source->getColorFormat();
if ( dest ) if ( dest )
destFormat = dest->getColorFormat (); destFormat = dest->getColorFormat();
switch ( operation ) switch ( operation )
{ {
@ -802,8 +802,8 @@ static tExecuteBlit getBlitter ( eBlitter operation,const video::IImage * dest,c
} }
/* /*
char buf[64]; char buf[64];
sprintf ( buf, "Blit: %d %d->%d unsupported",operation,sourceFormat,destFormat ); sprintf( buf, "Blit: %d %d->%d unsupported",operation,sourceFormat,destFormat );
os::Printer::log (buf ); os::Printer::log(buf );
*/ */
return 0; return 0;
@ -814,16 +814,15 @@ static tExecuteBlit getBlitter ( eBlitter operation,const video::IImage * dest,c
/*! /*!
a generic 2D Blitter a generic 2D Blitter
*/ */
static s32 Blit ( eBlitter operation, static s32 Blit(eBlitter operation,
video::IImage * dest, video::IImage * dest,
const core::rect<s32> *destClipping, const core::rect<s32> *destClipping,
const core::position2d<s32> *destPos, const core::position2d<s32> *destPos,
video::IImage * const source, video::IImage * const source,
const core::rect<s32> *sourceClipping, const core::rect<s32> *sourceClipping,
u32 argb u32 argb)
)
{ {
tExecuteBlit blitter = getBlitter ( operation, dest, source ); tExecuteBlit blitter = getBlitter( operation, dest, source );
if ( 0 == blitter ) if ( 0 == blitter )
{ {
return 0; return 0;
@ -871,8 +870,8 @@ static s32 Blit ( eBlitter operation,
v.x1 = v.x0 + ( sourceClip.x1 - sourceClip.x0 ); v.x1 = v.x0 + ( sourceClip.x1 - sourceClip.x0 );
v.y1 = v.y0 + ( sourceClip.y1 - sourceClip.y0 ); v.y1 = v.y0 + ( sourceClip.y1 - sourceClip.y0 );
intersect ( job.Dest, destClip, v ); intersect( job.Dest, destClip, v );
if ( !isValid ( job.Dest ) ) if ( !isValid( job.Dest ) )
return 0; return 0;
job.width = job.Dest.x1 - job.Dest.x0; job.width = job.Dest.x1 - job.Dest.x0;
@ -903,10 +902,10 @@ static s32 Blit ( eBlitter operation,
job.dstPixelMul = dest->getBytesPerPixel(); job.dstPixelMul = dest->getBytesPerPixel();
job.dst = (void*) ( (u8*) dest->lock() + ( job.Dest.y0 * job.dstPitch ) + ( job.Dest.x0 * job.dstPixelMul ) ); job.dst = (void*) ( (u8*) dest->lock() + ( job.Dest.y0 * job.dstPitch ) + ( job.Dest.x0 * job.dstPixelMul ) );
blitter ( &job ); blitter( &job );
if ( source ) if ( source )
source->unlock (); source->unlock();
if ( dest ) if ( dest )
dest->unlock(); dest->unlock();
@ -981,7 +980,7 @@ CImage::CImage(IImage* imageToCopy, const core::position2d<s32>& pos,
initData(); initData();
core::rect<s32> sClip( pos.X, pos.Y, pos.X + size.Width,pos.Y + size.Height ); core::rect<s32> sClip( pos.X, pos.Y, pos.X + size.Width,pos.Y + size.Height );
Blit ( BLITTER_TEXTURE, this, 0, 0, imageToCopy, &sClip,0 ); Blit (BLITTER_TEXTURE, this, 0, 0, imageToCopy, &sClip, 0);
} }
@ -1139,13 +1138,13 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color )
case ECF_A1R5G5B5: case ECF_A1R5G5B5:
{ {
u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 )); u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 ));
*dest = video::A8R8G8B8toA1R5G5B5 ( color.color ); *dest = video::A8R8G8B8toA1R5G5B5( color.color );
} break; } break;
case ECF_R5G6B5: case ECF_R5G6B5:
{ {
u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 )); u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 ));
*dest = video::A8R8G8B8toR5G6B5 ( color.color ); *dest = video::A8R8G8B8toR5G6B5( color.color );
} break; } break;
case ECF_R8G8B8: case ECF_R8G8B8:
@ -1199,22 +1198,22 @@ ECOLOR_FORMAT CImage::getColorFormat() const
//! draws a rectangle //! draws a rectangle
void CImage::drawRectangle(const core::rect<s32>& rect, const SColor &color) void CImage::drawRectangle(const core::rect<s32>& rect, const SColor &color)
{ {
Blit ( color.getAlpha() == 0xFF ? BLITTER_COLOR : BLITTER_COLOR_ALPHA, Blit(color.getAlpha() == 0xFF ? BLITTER_COLOR : BLITTER_COLOR_ALPHA,
this, 0, &rect.UpperLeftCorner, 0, &rect, color.color ); this, 0, &rect.UpperLeftCorner, 0, &rect, color.color);
} }
//! copies this surface into another //! copies this surface into another
void CImage::copyTo(IImage* target, const core::position2d<s32>& pos) void CImage::copyTo(IImage* target, const core::position2d<s32>& pos)
{ {
Blit ( BLITTER_TEXTURE, target, 0, &pos, this, 0, 0 ); Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0);
} }
//! copies this surface into another //! copies this surface into another
void CImage::copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect) void CImage::copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect)
{ {
Blit ( BLITTER_TEXTURE, target, clipRect, &pos, this, &sourceRect, 0 ); Blit(BLITTER_TEXTURE, target, clipRect, &pos, this, &sourceRect, 0);
} }
@ -1223,8 +1222,8 @@ void CImage::copyTo(IImage* target, const core::position2d<s32>& pos, const core
void CImage::copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const SColor &color, const core::rect<s32>* clipRect) void CImage::copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const SColor &color, const core::rect<s32>* clipRect)
{ {
// color blend only necessary on not full spectrum aka. color.color != 0xFFFFFFFF // color blend only necessary on not full spectrum aka. color.color != 0xFFFFFFFF
Blit ( color.color == 0xFFFFFFFF ? BLITTER_TEXTURE_ALPHA_BLEND: BLITTER_TEXTURE_ALPHA_COLOR_BLEND, Blit(color.color == 0xFFFFFFFF ? BLITTER_TEXTURE_ALPHA_BLEND: BLITTER_TEXTURE_ALPHA_COLOR_BLEND,
target, clipRect, &pos, this, &sourceRect, color.color ); target, clipRect, &pos, this, &sourceRect, color.color);
} }
@ -1233,34 +1232,34 @@ void CImage::copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, c
void CImage::drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color) void CImage::drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color)
{ {
AbsRectangle clip; AbsRectangle clip;
GetClip ( clip, this ); GetClip( clip, this );
core::position2d<s32> p[2]; core::position2d<s32> p[2];
if ( ClipLine ( clip, p[0], p[1], from, to ) ) if ( ClipLine( clip, p[0], p[1], from, to ) )
{ {
u32 alpha = extractAlpha ( color.color ); u32 alpha = extractAlpha( color.color );
switch ( Format ) switch ( Format )
{ {
case ECF_A1R5G5B5: case ECF_A1R5G5B5:
if ( alpha == 256 ) if ( alpha == 256 )
{ {
RenderLine16_Decal ( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5 ( color.color ) ); RenderLine16_Decal( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ) );
} }
else else
{ {
RenderLine16_Blend ( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5 ( color.color ), alpha >> 3 ); RenderLine16_Blend( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ), alpha >> 3 );
} }
break; break;
case ECF_A8R8G8B8: case ECF_A8R8G8B8:
if ( alpha == 256 ) if ( alpha == 256 )
{ {
RenderLine32_Decal ( this, p[0], p[1], color.color ); RenderLine32_Decal( this, p[0], p[1], color.color );
} }
else else
{ {
RenderLine32_Blend ( this, p[0], p[1], color.color, alpha ); RenderLine32_Blend( this, p[0], p[1], color.color, alpha );
} }
break; break;
} }
@ -1352,8 +1351,8 @@ void CImage::copyToScalingBoxFilter(IImage* target, s32 bias)
target->lock(); target->lock();
s32 fx = core::ceil32 ( sourceXStep ); s32 fx = core::ceil32( sourceXStep );
s32 fy = core::ceil32 ( sourceYStep ); s32 fy = core::ceil32( sourceYStep );
f32 sx; f32 sx;
f32 sy; f32 sy;
@ -1363,13 +1362,13 @@ void CImage::copyToScalingBoxFilter(IImage* target, s32 bias)
sx = 0.f; sx = 0.f;
for ( s32 x = 0; x != destSize.Width; ++x ) for ( s32 x = 0; x != destSize.Width; ++x )
{ {
target->setPixel ( x, y, getPixelBox( core::floor32 ( sx ), core::floor32 ( sy ), fx, fy, bias ) ); target->setPixel( x, y, getPixelBox( core::floor32( sx ), core::floor32( sy ), fx, fy, bias ) );
sx += sourceXStep; sx += sourceXStep;
} }
sy += sourceYStep; sy += sourceYStep;
} }
target->unlock (); target->unlock();
} }
@ -1381,11 +1380,11 @@ void CImage::fill(const SColor &color)
switch ( Format ) switch ( Format )
{ {
case ECF_A1R5G5B5: case ECF_A1R5G5B5:
c = video::A8R8G8B8toA1R5G5B5 ( color.color ); c = video::A8R8G8B8toA1R5G5B5( color.color );
c |= c << 16; c |= c << 16;
break; break;
case ECF_R5G6B5: case ECF_R5G6B5:
c = video::A8R8G8B8toR5G6B5 ( color.color ); c = video::A8R8G8B8toR5G6B5( color.color );
c |= c << 16; c |= c << 16;
break; break;
case ECF_A8R8G8B8: case ECF_A8R8G8B8:
@ -1396,12 +1395,12 @@ void CImage::fill(const SColor &color)
return; return;
} }
memset32 ( Data, c, getImageDataSizeInBytes () ); memset32( Data, c, getImageDataSizeInBytes() );
} }
//! get a filtered pixel //! get a filtered pixel
inline SColor CImage::getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const inline SColor CImage::getPixelBox( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const
{ {
SColor c; SColor c;
s32 a = 0, r = 0, g = 0, b = 0; s32 a = 0, r = 0, g = 0, b = 0;
@ -1410,9 +1409,9 @@ inline SColor CImage::getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) con
{ {
for ( s32 dy = 0; dy != fy; ++dy ) for ( s32 dy = 0; dy != fy; ++dy )
{ {
c = getPixel ( x + dx , y + dy ); c = getPixel( x + dx , y + dy );
a += c.getAlpha (); a += c.getAlpha();
r += c.getRed(); r += c.getRed();
g += c.getGreen(); g += c.getGreen();
b += c.getBlue(); b += c.getBlue();
@ -1421,12 +1420,12 @@ inline SColor CImage::getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) con
s32 sdiv = s32_log2_s32(fx * fy); s32 sdiv = s32_log2_s32(fx * fy);
a = core::s32_clamp ( ( a >> sdiv ) + bias, 0, 255 ); a = core::s32_clamp( ( a >> sdiv ) + bias, 0, 255 );
r = core::s32_clamp ( ( r >> sdiv ) + bias, 0, 255 ); r = core::s32_clamp( ( r >> sdiv ) + bias, 0, 255 );
g = core::s32_clamp ( ( g >> sdiv ) + bias, 0, 255 ); g = core::s32_clamp( ( g >> sdiv ) + bias, 0, 255 );
b = core::s32_clamp ( ( b >> sdiv ) + bias, 0, 255 ); b = core::s32_clamp( ( b >> sdiv ) + bias, 0, 255 );
c.set ( a, r, g, b ); c.set( a, r, g, b );
return c; return c;
} }

View File

@ -84,44 +84,40 @@ public:
//! returns the color format //! returns the color format
virtual ECOLOR_FORMAT getColorFormat() const; virtual ECOLOR_FORMAT getColorFormat() const;
//! draws a rectangle //! returns pitch of image
void drawRectangle(const core::rect<s32>& rect, const SColor &color); virtual u32 getPitch() const { return Pitch; }
//! copies this surface into another, scaling it to fit.
virtual void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch=0);
//! copies this surface into another, scaling it to fit.
virtual void copyToScaling(IImage* target);
//! copies this surface into another //! copies this surface into another
void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)); virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0));
//! copies this surface into another //! copies this surface into another
void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0); virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0);
//! copies this surface into another, using the alpha mask, an cliprect and a color to add with //! copies this surface into another, using the alpha mask, an cliprect and a color to add with
void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const SColor &color, const core::rect<s32>& sourceRect, const SColor &color,
const core::rect<s32>* clipRect = 0); const core::rect<s32>* clipRect = 0);
//! copies this surface into another, scaling it to fit.
void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch=0);
//! copies this surface into another, scaling it to fit.
void copyToScaling(IImage* target);
//! copies this surface into another, scaling it to fit, appyling a box filter //! copies this surface into another, scaling it to fit, appyling a box filter
void copyToScalingBoxFilter(IImage* target, s32 bias = 0); void copyToScalingBoxFilter(IImage* target, s32 bias = 0);
//! fills the surface with black or white
virtual void fill(const SColor &color);
//! draws a rectangle
void drawRectangle(const core::rect<s32>& rect, const SColor &color);
//! draws a line from to //! draws a line from to
void drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color); void drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color);
//! fills the surface with black or white
void fill(const SColor &color);
//! returns pitch of image
virtual u32 getPitch() const
{
return Pitch;
}
static u32 getBitsPerPixelFromFormat(ECOLOR_FORMAT format); static u32 getBitsPerPixelFromFormat(ECOLOR_FORMAT format);
private: private:
//! assumes format and size has been set and creates the rest //! assumes format and size has been set and creates the rest

View File

@ -12,6 +12,7 @@
#include "IImageLoader.h" #include "IImageLoader.h"
#include "IImageWriter.h" #include "IImageWriter.h"
#include "IMaterialRenderer.h" #include "IMaterialRenderer.h"
#include "CMeshManipulator.h"
namespace irr namespace irr
@ -68,7 +69,7 @@ IImageWriter* createImageWriterPPM();
//! constructor //! constructor
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& screenSize) CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& screenSize)
: FileSystem(io), ViewPort(0,0,0,0), ScreenSize(screenSize), : FileSystem(io), MeshManipulator(0), ViewPort(0,0,0,0), ScreenSize(screenSize),
PrimitivesDrawn(0), TextureCreationFlags(0) PrimitivesDrawn(0), TextureCreationFlags(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
@ -82,6 +83,9 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& scre
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), screenSize); ViewPort = core::rect<s32>(core::position2d<s32>(0,0), screenSize);
// create manipulator
MeshManipulator = new scene::CMeshManipulator();
if (FileSystem) if (FileSystem)
FileSystem->grab(); FileSystem->grab();
@ -139,23 +143,20 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& scre
} }
//! destructor //! destructor
CNullDriver::~CNullDriver() CNullDriver::~CNullDriver()
{ {
// drop file system
if (FileSystem) if (FileSystem)
FileSystem->drop(); FileSystem->drop();
// delete textures if (MeshManipulator)
MeshManipulator->drop();
deleteAllTextures(); deleteAllTextures();
// delete surface loader
u32 i; u32 i;
for (i=0; i<SurfaceLoader.size(); ++i) for (i=0; i<SurfaceLoader.size(); ++i)
SurfaceLoader[i]->drop(); SurfaceLoader[i]->drop();
// delete surface writer
for (i=0; i<SurfaceWriter.size(); ++i) for (i=0; i<SurfaceWriter.size(); ++i)
SurfaceWriter[i]->drop(); SurfaceWriter[i]->drop();
@ -1231,9 +1232,30 @@ IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
} }
//! Creates an empty software image.
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, const core::dimension2d<s32>& size)
{
return new CImage(format, size);
}
//! Creates a software image from another image.
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, IImage *imageToCopy)
{
return new CImage(format, imageToCopy);
}
//! Creates a software image from part of another image.
IImage* CNullDriver::createImage(IImage* imageToCopy, const core::position2d<s32>& pos, const core::dimension2d<s32>& size)
{
return new CImage(imageToCopy, pos, size);
}
//! Sets the fog mode. //! Sets the fog mode.
void CNullDriver::setFog(SColor color, bool linearFog, f32 start, f32 end, f32 density, void CNullDriver::setFog(SColor color, bool linearFog, f32 start, f32 end,
bool pixelFog, bool rangeFog) f32 density, bool pixelFog, bool rangeFog)
{ {
FogColor = color; FogColor = color;
LinearFog = linearFog; LinearFog = linearFog;
@ -1790,6 +1812,14 @@ void CNullDriver::clearZBuffer()
{ {
} }
//! Returns a pointer to the mesh manipulator.
scene::IMeshManipulator* CNullDriver::getMeshManipulator()
{
return MeshManipulator;
}
//! Returns an image created from the last rendered frame. //! Returns an image created from the last rendered frame.
IImage* CNullDriver::createScreenShot() IImage* CNullDriver::createScreenShot()
{ {

View File

@ -286,13 +286,24 @@ namespace video
virtual IImage* createImageFromFile(io::IReadFile* file); virtual IImage* createImageFromFile(io::IReadFile* file);
//! Creates a software image from a byte array. //! Creates a software image from a byte array.
//! \param useForeignMemory: If true, the image will use the data pointer /** \param useForeignMemory: If true, the image will use the data pointer
//! directly and own it from now on, which means it will also try to delete [] the directly and own it from now on, which means it will also try to delete [] the
//! data when the image will be destructed. If false, the memory will by copied. data when the image will be destructed. If false, the memory will by copied. */
virtual IImage* createImageFromData(ECOLOR_FORMAT format, virtual IImage* createImageFromData(ECOLOR_FORMAT format,
const core::dimension2d<s32>& size, void *data, const core::dimension2d<s32>& size, void *data,
bool ownForeignMemory=true, bool deleteForeignMemory = true); bool ownForeignMemory=true, bool deleteForeignMemory = true);
//! Creates an empty software image.
virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<s32>& size);
//! Creates a software image from another image.
virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy);
//! Creates a software image from part of another image.
virtual IImage* createImage(IImage* imageToCopy,
const core::position2d<s32>& pos, const core::dimension2d<s32>& size);
//! Draws a mesh buffer //! Draws a mesh buffer
virtual void drawMeshBuffer(const scene::IMeshBuffer* mb); virtual void drawMeshBuffer(const scene::IMeshBuffer* mb);
@ -317,11 +328,8 @@ namespace video
u32 ChangedID_Index; u32 ChangedID_Index;
u32 LastUsed; u32 LastUsed;
scene::E_HARDWARE_MAPPING Mapped; scene::E_HARDWARE_MAPPING Mapped;
}; };
//! Gets hardware buffer link from a meshbuffer (may create or update buffer) //! Gets hardware buffer link from a meshbuffer (may create or update buffer)
virtual SHWBufferLink *getBufferLink(const scene::IMeshBuffer* mb); virtual SHWBufferLink *getBufferLink(const scene::IMeshBuffer* mb);
@ -350,8 +358,8 @@ namespace video
virtual bool isHardwareBufferRecommend(const scene::IMeshBuffer* mb); virtual bool isHardwareBufferRecommend(const scene::IMeshBuffer* mb);
public: public:
//! Only used by the internal engine. Used to notify the driver that //! Only used by the engine internally.
//! the window was resized. /** Used to notify the driver that the window was resized. */
virtual void OnResize(const core::dimension2d<s32>& size); virtual void OnResize(const core::dimension2d<s32>& size);
//! Adds a new material renderer to the video device. //! Adds a new material renderer to the video device.
@ -442,6 +450,9 @@ namespace video
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData=0); s32 userData=0);
//! Returns a pointer to the mesh manipulator.
virtual scene::IMeshManipulator* getMeshManipulator();
//! Clears the ZBuffer. //! Clears the ZBuffer.
virtual void clearZBuffer(); virtual void clearZBuffer();
@ -570,6 +581,9 @@ namespace video
io::IFileSystem* FileSystem; io::IFileSystem* FileSystem;
//! mesh manipulator
scene::IMeshManipulator* MeshManipulator;
core::rect<s32> ViewPort; core::rect<s32> ViewPort;
core::dimension2d<s32> ScreenSize; core::dimension2d<s32> ScreenSize;
core::matrix4 TransformationMatrix; core::matrix4 TransformationMatrix;

View File

@ -44,9 +44,10 @@ const u16 COGRE_SUBMESH_OPERATION= 0x4010;
const u16 COGRE_SUBMESH_BONE_ASSIGNMENT= 0x4100; const u16 COGRE_SUBMESH_BONE_ASSIGNMENT= 0x4100;
const u16 COGRE_SUBMESH_TEXTURE_ALIAS= 0x4200; const u16 COGRE_SUBMESH_TEXTURE_ALIAS= 0x4200;
//! Constructor //! Constructor
COgreMeshFileLoader::COgreMeshFileLoader(IMeshManipulator* manip,io::IFileSystem* fs, video::IVideoDriver* driver) COgreMeshFileLoader::COgreMeshFileLoader(io::IFileSystem* fs, video::IVideoDriver* driver)
: FileSystem(fs), Driver(driver), SwapEndian(false), Mesh(0), Manipulator(manip), NumUV(0) : FileSystem(fs), Driver(driver), SwapEndian(false), Mesh(0), NumUV(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
@ -61,7 +62,6 @@ COgreMeshFileLoader::COgreMeshFileLoader(IMeshManipulator* manip,io::IFileSystem
} }
//! destructor //! destructor
COgreMeshFileLoader::~COgreMeshFileLoader() COgreMeshFileLoader::~COgreMeshFileLoader()
{ {
@ -78,7 +78,6 @@ COgreMeshFileLoader::~COgreMeshFileLoader()
} }
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".bsp") //! based on the file extension (e.g. ".bsp")
bool COgreMeshFileLoader::isALoadableFileExtension(const c8* filename) const bool COgreMeshFileLoader::isALoadableFileExtension(const c8* filename) const
@ -87,7 +86,6 @@ bool COgreMeshFileLoader::isALoadableFileExtension(const c8* filename) const
} }
//! creates/loads an animated mesh from the file. //! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed. //! \return Pointer to the created mesh. Returns 0 if loading failed.
//! If you no longer need the mesh, you should call IAnimatedMesh::drop(). //! If you no longer need the mesh, you should call IAnimatedMesh::drop().

View File

@ -27,7 +27,7 @@ class COgreMeshFileLoader : public IMeshLoader
public: public:
//! Constructor //! Constructor
COgreMeshFileLoader(IMeshManipulator* manip,io::IFileSystem* fs, video::IVideoDriver* driver); COgreMeshFileLoader(io::IFileSystem* fs, video::IVideoDriver* driver);
//! destructor //! destructor
virtual ~COgreMeshFileLoader(); virtual ~COgreMeshFileLoader();
@ -230,7 +230,6 @@ private:
core::array<OgreMaterial> Materials; core::array<OgreMaterial> Materials;
SMesh* Mesh; SMesh* Mesh;
IMeshManipulator* Manipulator;
u32 NumUV; u32 NumUV;
}; };

View File

@ -123,7 +123,6 @@
#include "CDefaultSceneNodeFactory.h" #include "CDefaultSceneNodeFactory.h"
#include "CSceneCollisionManager.h" #include "CSceneCollisionManager.h"
#include "CMeshManipulator.h"
#include "CTriangleSelector.h" #include "CTriangleSelector.h"
#include "COctTreeTriangleSelector.h" #include "COctTreeTriangleSelector.h"
#include "CTriangleBBSelector.h" #include "CTriangleBBSelector.h"
@ -157,7 +156,7 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
gui::ICursorControl* cursorControl, IMeshCache* cache, gui::ICursorControl* cursorControl, IMeshCache* cache,
gui::IGUIEnvironment* gui) gui::IGUIEnvironment* gui)
: ISceneNode(0, 0), Driver(driver), FileSystem(fs), GUIEnvironment(gui), : ISceneNode(0, 0), Driver(driver), FileSystem(fs), GUIEnvironment(gui),
CursorControl(cursorControl), CollisionManager(0), MeshManipulator(0), CursorControl(cursorControl), CollisionManager(0),
ActiveCamera(0), ShadowColor(150,0,0,0), AmbientLight(0,0,0,0), ActiveCamera(0), ShadowColor(150,0,0,0), AmbientLight(0,0,0,0),
MeshCache(cache), CurrentRendertime(ESNRP_COUNT), MeshCache(cache), CurrentRendertime(ESNRP_COUNT),
IRR_XML_FORMAT_SCENE(L"irr_scene"), IRR_XML_FORMAT_NODE(L"node"), IRR_XML_FORMAT_NODE_ATTR_TYPE(L"type") IRR_XML_FORMAT_SCENE(L"irr_scene"), IRR_XML_FORMAT_NODE(L"node"), IRR_XML_FORMAT_NODE_ATTR_TYPE(L"type")
@ -188,9 +187,6 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
// create collision manager // create collision manager
CollisionManager = new CSceneCollisionManager(this, Driver); CollisionManager = new CSceneCollisionManager(this, Driver);
// create manipulator
MeshManipulator = new CMeshManipulator();
// add file format loaders // add file format loaders
#ifdef _IRR_COMPILE_WITH_IRR_MESH_LOADER_ #ifdef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
@ -230,7 +226,7 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
MeshLoaderList.push_back(new CDMFLoader(this)); MeshLoaderList.push_back(new CDMFLoader(this));
#endif #endif
#ifdef _IRR_COMPILE_WITH_OGRE_LOADER_ #ifdef _IRR_COMPILE_WITH_OGRE_LOADER_
MeshLoaderList.push_back(new COgreMeshFileLoader(MeshManipulator, FileSystem, Driver)); MeshLoaderList.push_back(new COgreMeshFileLoader(FileSystem, Driver));
#endif #endif
#ifdef _IRR_COMPILE_WITH_OBJ_LOADER_ #ifdef _IRR_COMPILE_WITH_OBJ_LOADER_
MeshLoaderList.push_back(new COBJMeshFileLoader(this, FileSystem)); MeshLoaderList.push_back(new COBJMeshFileLoader(this, FileSystem));
@ -274,9 +270,6 @@ CSceneManager::~CSceneManager()
if (CollisionManager) if (CollisionManager)
CollisionManager->drop(); CollisionManager->drop();
if (MeshManipulator)
MeshManipulator->drop();
if (GUIEnvironment) if (GUIEnvironment)
GUIEnvironment->drop(); GUIEnvironment->drop();
@ -1464,7 +1457,6 @@ void CSceneManager::addExternalMeshLoader(IMeshLoader* externalLoader)
} }
//! Returns a pointer to the scene collision manager. //! Returns a pointer to the scene collision manager.
ISceneCollisionManager* CSceneManager::getSceneCollisionManager() ISceneCollisionManager* CSceneManager::getSceneCollisionManager()
{ {
@ -1475,7 +1467,7 @@ ISceneCollisionManager* CSceneManager::getSceneCollisionManager()
//! Returns a pointer to the mesh manipulator. //! Returns a pointer to the mesh manipulator.
IMeshManipulator* CSceneManager::getMeshManipulator() IMeshManipulator* CSceneManager::getMeshManipulator()
{ {
return MeshManipulator; return Driver->getMeshManipulator();
} }

View File

@ -555,9 +555,6 @@ namespace scene
//! collision manager //! collision manager
ISceneCollisionManager* CollisionManager; ISceneCollisionManager* CollisionManager;
//! mesh manipulator
IMeshManipulator* MeshManipulator;
//! render pass lists //! render pass lists
core::array<ISceneNode*> CameraList; core::array<ISceneNode*> CameraList;
core::array<DistanceNodeEntry> LightList; core::array<DistanceNodeEntry> LightList;