Fixed Ogre file format check to support new version. Fixed some missing inits. Changed some tests to switch statements.
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@679 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
82b706a874
commit
002dd4523d
@ -683,7 +683,7 @@ f32 CAttributes::getAttributeAsFloat(s32 index)
|
||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||
video::SColor CAttributes::getAttributeAsColor(s32 index)
|
||||
{
|
||||
video::SColor ret;
|
||||
video::SColor ret(0);
|
||||
|
||||
if (index >= 0 && index < (s32)Attributes.size())
|
||||
ret = Attributes[index]->getColor();
|
||||
|
@ -893,6 +893,7 @@ void CColladaFileLoader::readPolygonSection(io::IXMLReaderUTF8* reader,
|
||||
if (!Inputs.empty())
|
||||
{
|
||||
SInputSlot slot;
|
||||
slot.Data=0;
|
||||
slot.Semantic = Inputs.getLast().Semantic;
|
||||
|
||||
core::stringc sourceArrayURI;
|
||||
|
@ -101,9 +101,8 @@ void jpeg_memory_dest (j_compress_ptr cinfo, u8 *jfif_buffer,
|
||||
/* write_JPEG_memory: store JPEG compressed image into memory.
|
||||
*/
|
||||
void write_JPEG_memory (void *img_buf, s32 width, s32 height, u32 bpp, u32 pitch,
|
||||
u8 *jpeg_buffer, u32 jpeg_buffer_size,
|
||||
s32 quality, u32 *jpeg_comp_size
|
||||
)
|
||||
u8 *jpeg_buffer, u32 jpeg_buffer_size,
|
||||
s32 quality, u32 *jpeg_comp_size)
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
@ -111,7 +110,6 @@ void write_JPEG_memory (void *img_buf, s32 width, s32 height, u32 bpp, u32 pitch
|
||||
/* More stuff */
|
||||
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
|
||||
|
||||
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_compress(&cinfo);
|
||||
jpeg_memory_dest(&cinfo, jpeg_buffer, jpeg_buffer_size);
|
||||
@ -197,7 +195,7 @@ bool CImageWriterJPG::writeImage(io::IWriteFile *file, IImage *input,u32 quality
|
||||
void *dst = image->lock();
|
||||
for ( y = 0; y!= dim.Height; ++y )
|
||||
{
|
||||
format ( src, dim.Width, dst );
|
||||
format( src, dim.Width, dst );
|
||||
src = (void*) ( (u8*) src + input->getPitch () );
|
||||
dst = (void*) ( (u8*) dst + image->getPitch () );
|
||||
}
|
||||
@ -212,11 +210,10 @@ bool CImageWriterJPG::writeImage(io::IWriteFile *file, IImage *input,u32 quality
|
||||
quality = 75;
|
||||
|
||||
write_JPEG_memory ( image->lock (), dim.Width, dim.Height,
|
||||
image->getBytesPerPixel(), image->getPitch (),
|
||||
dest, destSize,
|
||||
quality,
|
||||
&destSize
|
||||
);
|
||||
image->getBytesPerPixel(), image->getPitch(),
|
||||
dest, destSize,
|
||||
quality,
|
||||
&destSize);
|
||||
|
||||
file->write ( dest, destSize );
|
||||
|
||||
|
@ -96,16 +96,21 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
|
||||
png_set_write_fn(png_ptr, file, user_write_data_fcn, NULL);
|
||||
|
||||
// Set info
|
||||
if ((image->getColorFormat()==ECF_A8R8G8B8) || (image->getColorFormat()==ECF_A1R5G5B5))
|
||||
png_set_IHDR(png_ptr, info_ptr,
|
||||
image->getDimension().Width, image->getDimension().Height,
|
||||
8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
else
|
||||
png_set_IHDR(png_ptr, info_ptr,
|
||||
image->getDimension().Width, image->getDimension().Height,
|
||||
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
switch(image->getColorFormat())
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
png_set_IHDR(png_ptr, info_ptr,
|
||||
image->getDimension().Width, image->getDimension().Height,
|
||||
8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
break;
|
||||
default:
|
||||
png_set_IHDR(png_ptr, info_ptr,
|
||||
image->getDimension().Width, image->getDimension().Height,
|
||||
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
}
|
||||
|
||||
s32 lineWidth=image->getDimension().Width;
|
||||
switch(image->getColorFormat())
|
||||
|
@ -56,7 +56,6 @@ inline void recalculateNormalsT_Smooth(VTXTYPE* v, int vtxcnt,
|
||||
{
|
||||
v[i].Normal.normalize ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +126,7 @@ void CMeshManipulator::flipSurfaces(scene::IMesh* mesh) const
|
||||
for (u32 b=0; b<bcount; ++b)
|
||||
{
|
||||
IMeshBuffer* buffer = mesh->getMeshBuffer(b);
|
||||
u32 idxcnt = buffer->getIndexCount();
|
||||
const u32 idxcnt = buffer->getIndexCount();
|
||||
u16* idx = buffer->getIndices();
|
||||
s32 tmp;
|
||||
|
||||
@ -334,9 +333,7 @@ void CMeshManipulator::transformMesh(scene::IMesh* mesh, const core::matrix4& m)
|
||||
meshbox.addInternalBox(buffer->getBoundingBox());
|
||||
}
|
||||
|
||||
|
||||
mesh->setBoundingBox( meshbox );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -936,7 +933,6 @@ IAnimatedMesh * CMeshManipulator::createAnimatedMesh(scene::IMesh* mesh,scene::E
|
||||
//mesh->drop ();
|
||||
|
||||
return animatedMesh;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace irr
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! An interface for easily manipulate meshes.
|
||||
//! An interface for easy manipulation of meshes.
|
||||
/** Scale, set alpha value, flip surfaces, and so on. This exists for fixing problems
|
||||
with wrong imported or exported meshes quickly after loading. It is not intended for doing mesh
|
||||
modifications and/or animations during runtime.
|
||||
|
@ -98,7 +98,7 @@ IAnimatedMesh* COgreMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
return 0;
|
||||
ChunkData data;
|
||||
readString(file, data, Version);
|
||||
if (Version != "[MeshSerializer_v1.30]")
|
||||
if ((Version != "[MeshSerializer_v1.30]") && (Version != "[MeshSerializer_v1.40]"))
|
||||
return 0;
|
||||
|
||||
clearMeshes();
|
||||
|
Loading…
x
Reference in New Issue
Block a user