Merging r6405 through r6424 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6425 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-09-22 21:55:03 +00:00
parent ddc14ea87e
commit 07f17647d2
46 changed files with 589 additions and 463 deletions

View File

@ -28,16 +28,16 @@ CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 i
// set default projection
Fovy = core::PI / 2.5f; // Field of view, in radians.
Aspect = 4.0f / 3.0f; // Aspect ratio.
const video::IVideoDriver* const d = mgr?mgr->getVideoDriver():0;
if (d)
{
Aspect = (f32)d->getCurrentRenderTargetSize().Width /
(f32)d->getCurrentRenderTargetSize().Height;
if ( d->getCurrentRenderTargetSize().Height )
Aspect = (f32)d->getCurrentRenderTargetSize().Width /
(f32)d->getCurrentRenderTargetSize().Height;
HasD3DStyleProjectionMatrix = d->getDriverType() != video::EDT_OPENGL;
}
else
Aspect = 4.0f / 3.0f; // Aspect ratio.
ViewArea.setFarNearDistance(ZFar - ZNear);
recalculateProjectionMatrix();
@ -252,6 +252,7 @@ void CCameraSceneNode::OnRegisterSceneNode()
//! render
void CCameraSceneNode::render()
{
updateAbsolutePosition(); // depending on that call in onAnimate is risky (might not be in SceneManager or it or it's parent might be invisible and still should render)
updateMatrices();
video::IVideoDriver* driver = SceneManager->getVideoDriver();

View File

@ -1827,7 +1827,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
if ( buffer->getPrimitiveType() != EPT_TRIANGLES )
{
os::Printer::log("Collada writer does not support non-triangle meshbuffers. Mesh: ", meshname.c_str(), ELL_WARNING);
os::Printer::log("Collada writer does not support non-triangle meshbuffers. Mesh", meshname.c_str(), ELL_WARNING);
continue;
}
@ -1865,12 +1865,16 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
Writer->writeElement("p", false);
const video::E_INDEX_TYPE iType = buffer->getIndexType();
const u16* idx16 = buffer->getIndices();
const u32* idx32 = (u32*)buffer->getIndices();
core::stringc strP;
strP.reserve(100);
for (u32 p=0; p<polyCount; ++p)
{
// Irrlicht uses clockwise, Collada uses counter-clockwise to define front-face
u32 irrIdx = buffer->getIndices()[(p*3) + 2];
u32 irrIdx = iType == video::EIT_16BIT ? idx16[p*3 + 2] : idx32[p*3 + 2];
strP = "";
strP += irrIdx + posIdx;
strP += " ";
@ -1884,7 +1888,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
strP += " ";
}
irrIdx = buffer->getIndices()[(p*3) + 1];
irrIdx = iType == video::EIT_16BIT ? idx16[p*3 + 1] : idx32[p*3 + 1];
strP += irrIdx + posIdx;
strP += " ";
strP += irrIdx + tCoordIdx;
@ -1897,7 +1901,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
strP += " ";
}
irrIdx = buffer->getIndices()[(p*3) + 0];
irrIdx = iType == video::EIT_16BIT ? idx16[p*3] : idx32[p*3];
strP += irrIdx + posIdx;
strP += " ";
strP += irrIdx + tCoordIdx;

View File

@ -3001,7 +3001,7 @@ bool CD3D9Driver::reset()
}
else
{
os::Printer::log("Resetting failed due to unknown reason.", core::stringc((int)hr).c_str(), ELL_WARNING);
os::Printer::log("Resetting failed due to unknown reason", core::stringc((int)hr).c_str(), ELL_WARNING);
}
return false;
}

View File

@ -339,7 +339,7 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
case EMIE_MOUSE_MOVED:
if (Environment->hasFocus(this))
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
return true;
break;
default:
break;
}
@ -423,7 +423,7 @@ u32 CGUIContextMenu::sendClick(const core::position2d<s32>& p)
}
//! returns true, if an element was highligted
//! returns true, if an element was highlighted
bool CGUIContextMenu::highlight(const core::position2d<s32>& p, bool canOpenSubMenu)
{
if (!isEnabled())

View File

@ -810,7 +810,7 @@ bool CGUIEnvironment::loadGUI(const io::path& filename, IGUIElement* parent)
io::IReadFile* read = FileSystem->createAndOpenFile(filename);
if (!read)
{
os::Printer::log("Unable to open gui file", filename, ELL_ERROR);
os::Printer::log("Unable to open GUI file", filename, ELL_ERROR);
return false;
}

View File

@ -137,7 +137,7 @@ bool CImageLoaderJPG::isALoadableFileFormat(io::IReadFile* file) const
IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
{
#ifndef _IRR_COMPILE_WITH_LIBJPEG_
os::Printer::log("Can't load as not compiled with _IRR_COMPILE_WITH_LIBJPEG_:", file->getFileName(), ELL_DEBUG);
os::Printer::log("Can't load as not compiled with _IRR_COMPILE_WITH_LIBJPEG_", file->getFileName(), ELL_DEBUG);
return 0;
#else

View File

@ -99,14 +99,14 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
// Read the first few bytes of the PNG file
if( file->read(buffer, 8) != 8 )
{
os::Printer::log("LOAD PNG: can't read file\n", file->getFileName(), ELL_ERROR);
os::Printer::log("LOAD PNG: can't read file (filesize < 8)", file->getFileName(), ELL_ERROR);
return 0;
}
// Check if it really is a PNG file
if( png_sig_cmp(buffer, 0, 8) )
{
os::Printer::log("LOAD PNG: not really a png\n", file->getFileName(), ELL_ERROR);
os::Printer::log("LOAD PNG: not really a png (wrong signature)", file->getFileName(), ELL_ERROR);
return 0;
}
@ -115,7 +115,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
NULL, (png_error_ptr)png_cpexcept_error, (png_error_ptr)png_cpexcept_warn);
if (!png_ptr)
{
os::Printer::log("LOAD PNG: Internal PNG create read struct failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("LOAD PNG: Internal PNG create read struct failure", file->getFileName(), ELL_ERROR);
return 0;
}
@ -123,7 +123,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
os::Printer::log("LOAD PNG: Internal PNG create info struct failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("LOAD PNG: Internal PNG create info struct failure", file->getFileName(), ELL_ERROR);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return 0;
}
@ -143,10 +143,10 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
png_read_info(png_ptr, info_ptr); // Read the info section of the png file
u32 Width;
u32 Height;
s32 BitDepth;
s32 ColorType;
u32 Width=0;
u32 Height=0;
s32 BitDepth=0;
s32 ColorType=0;
{
// Use temporary variables to avoid passing cast pointers
png_uint_32 w,h;
@ -158,9 +158,6 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
Height=h;
}
if (!IImage::checkDataSizeLimit((size_t)Width* Height * (BitDepth/8)))
png_cpexcept_error(png_ptr, "Image dimensions too large");
// Convert palette color to true color
if (ColorType==PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
@ -223,15 +220,16 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
#endif
}
ECOLOR_FORMAT colorFormat = ColorType==PNG_COLOR_TYPE_RGB_ALPHA ? ECF_A8R8G8B8 : ECF_R8G8B8;
if (!IImage::checkDataSizeLimit(IImage::getDataSizeFromFormat(colorFormat, Width, Height)))
png_cpexcept_error(png_ptr, "Image dimensions too large");
// Create the image structure to be filled by png data
video::IImage* image = 0;
if (ColorType==PNG_COLOR_TYPE_RGB_ALPHA)
image = new CImage(ECF_A8R8G8B8, core::dimension2d<u32>(Width, Height));
else
image = new CImage(ECF_R8G8B8, core::dimension2d<u32>(Width, Height));
video::IImage* image = new CImage(colorFormat, core::dimension2du(Width, Height));
if (!image)
{
os::Printer::log("LOAD PNG: Internal PNG create image struct failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("LOAD PNG: Internal PNG create image struct failure", file->getFileName(), ELL_ERROR);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return 0;
}
@ -240,7 +238,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
RowPointers = new png_bytep[Height];
if (!RowPointers)
{
os::Printer::log("LOAD PNG: Internal PNG create row pointers failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("LOAD PNG: Internal PNG create row pointers failure", file->getFileName(), ELL_ERROR);
png_destroy_read_struct(&png_ptr, NULL, NULL);
delete image;
return 0;

View File

@ -80,7 +80,7 @@ IImage* CImageLoaderPSD::loadImage(io::IReadFile* file) const
if (header.mode != 3 || header.depth != 8)
{
os::Printer::log("Unsupported PSD color mode or depth.\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Unsupported PSD color mode or depth", file->getFileName(), ELL_ERROR);
return 0;
}
@ -93,7 +93,7 @@ IImage* CImageLoaderPSD::loadImage(io::IReadFile* file) const
#endif
if (!file->seek(l, true))
{
os::Printer::log("Error seeking file pos to image resources.\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Error seeking file pos to image resources", file->getFileName(), ELL_ERROR);
return 0;
}
@ -105,7 +105,7 @@ IImage* CImageLoaderPSD::loadImage(io::IReadFile* file) const
#endif
if (!file->seek(l, true))
{
os::Printer::log("Error seeking file pos to layer and mask.\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Error seeking file pos to layer and mask", file->getFileName(), ELL_ERROR);
return 0;
}
@ -117,7 +117,7 @@ IImage* CImageLoaderPSD::loadImage(io::IReadFile* file) const
#endif
if (!file->seek(l, true))
{
os::Printer::log("Error seeking file pos to image data section.\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Error seeking file pos to image data section", file->getFileName(), ELL_ERROR);
return 0;
}
@ -131,7 +131,7 @@ IImage* CImageLoaderPSD::loadImage(io::IReadFile* file) const
if (compressionType != 1 && compressionType != 0)
{
os::Printer::log("Unsupported psd compression mode.\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Unsupported psd compression mode", file->getFileName(), ELL_ERROR);
return 0;
}
@ -171,7 +171,7 @@ bool CImageLoaderPSD::readRawImageData(io::IReadFile* file, const PsdHeader& hea
{
if (!file->read(tmpData, sizeof(c8) * header.width * header.height))
{
os::Printer::log("Error reading color channel\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Error reading color channel", file->getFileName(), ELL_ERROR);
break;
}
@ -247,7 +247,7 @@ bool CImageLoaderPSD::readRLEImageData(io::IReadFile* file, const PsdHeader& hea
{
delete [] tmpData;
delete [] rleCount;
os::Printer::log("Error reading rle rows\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Error reading rle rows", file->getFileName(), ELL_ERROR);
return false;
}
@ -263,7 +263,7 @@ bool CImageLoaderPSD::readRLEImageData(io::IReadFile* file, const PsdHeader& hea
delete [] rleCount;
delete [] buf;
delete [] tmpData;
os::Printer::log("Error reading rle rows\n", file->getFileName(), ELL_ERROR);
os::Printer::log("Error reading rle rows", file->getFileName(), ELL_ERROR);
return false;
}

View File

@ -108,7 +108,7 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const
if (!IImage::checkDataSizeLimit((size_t)header.ImageWidth* header.ImageHeight * (header.PixelDepth/8)))
{
os::Printer::log("Image dimensions too large in file.", file->getFileName(), ELL_ERROR);
os::Printer::log("Image dimensions too large in file", file->getFileName(), ELL_ERROR);
return 0;
}

View File

@ -84,7 +84,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
NULL, (png_error_ptr)png_cpexcept_error, (png_error_ptr)png_cpexcept_warning);
if (!png_ptr)
{
os::Printer::log("PNGWriter: Internal PNG create write struct failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("PNGWriter: Internal PNG create write struct failure", file->getFileName(), ELL_ERROR);
return false;
}
@ -92,7 +92,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
os::Printer::log("PNGWriter: Internal PNG create info struct failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("PNGWriter: Internal PNG create info struct failure", file->getFileName(), ELL_ERROR);
png_destroy_write_struct(&png_ptr, NULL);
return false;
}
@ -141,7 +141,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
u8* tmpImage = new u8[image->getDimension().Height*lineWidth];
if (!tmpImage)
{
os::Printer::log("PNGWriter: Internal PNG create image failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("PNGWriter: Internal PNG create image failure", file->getFileName(), ELL_ERROR);
png_destroy_write_struct(&png_ptr, &info_ptr);
return false;
}
@ -175,7 +175,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
u8** RowPointers = new png_bytep[image->getDimension().Height];
if (!RowPointers)
{
os::Printer::log("PNGWriter: Internal PNG create row pointers failure\n", file->getFileName(), ELL_ERROR);
os::Printer::log("PNGWriter: Internal PNG create row pointers failure", file->getFileName(), ELL_ERROR);
png_destroy_write_struct(&png_ptr, &info_ptr);
delete [] tmpImage;
return false;

View File

@ -306,8 +306,8 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
if (bestMode != -1)
{
os::Printer::log("Starting vidmode fullscreen mode...", ELL_INFORMATION);
os::Printer::log("hdisplay: ", core::stringc(modes[bestMode]->hdisplay).c_str(), ELL_INFORMATION);
os::Printer::log("vdisplay: ", core::stringc(modes[bestMode]->vdisplay).c_str(), ELL_INFORMATION);
os::Printer::log("hdisplay", core::stringc(modes[bestMode]->hdisplay).c_str(), ELL_INFORMATION);
os::Printer::log("vdisplay", core::stringc(modes[bestMode]->vdisplay).c_str(), ELL_INFORMATION);
XF86VidModeSwitchToMode(XDisplay, Screennr, modes[bestMode]);
XF86VidModeSetViewPort(XDisplay, Screennr, 0, 0);
@ -343,8 +343,8 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
if (bestMode != -1)
{
os::Printer::log("Starting randr fullscreen mode...", ELL_INFORMATION);
os::Printer::log("width: ", core::stringc(modes[bestMode].width).c_str(), ELL_INFORMATION);
os::Printer::log("height: ", core::stringc(modes[bestMode].height).c_str(), ELL_INFORMATION);
os::Printer::log("width", core::stringc(modes[bestMode].width).c_str(), ELL_INFORMATION);
os::Printer::log("height", core::stringc(modes[bestMode].height).c_str(), ELL_INFORMATION);
XRRSetScreenConfig(XDisplay,config,DefaultRootWindow(XDisplay),bestMode,OldRandrRotation,CurrentTime);
UseXRandR=true;
@ -367,26 +367,26 @@ void IrrPrintXGrabError(int grabResult, const c8 * grabCommand )
{
if ( grabResult == GrabSuccess )
{
// os::Printer::log(grabCommand, ": GrabSuccess", ELL_INFORMATION);
// os::Printer::log(grabCommand, "GrabSuccess", ELL_INFORMATION);
return;
}
switch ( grabResult )
{
case AlreadyGrabbed:
os::Printer::log(grabCommand, ": AlreadyGrabbed", ELL_WARNING);
os::Printer::log(grabCommand, "AlreadyGrabbed", ELL_WARNING);
break;
case GrabNotViewable:
os::Printer::log(grabCommand, ": GrabNotViewable", ELL_WARNING);
os::Printer::log(grabCommand, "GrabNotViewable", ELL_WARNING);
break;
case GrabFrozen:
os::Printer::log(grabCommand, ": GrabFrozen", ELL_WARNING);
os::Printer::log(grabCommand, "GrabFrozen", ELL_WARNING);
break;
case GrabInvalidTime:
os::Printer::log(grabCommand, ": GrabInvalidTime", ELL_WARNING);
os::Printer::log(grabCommand, "GrabInvalidTime", ELL_WARNING);
break;
default:
os::Printer::log(grabCommand, ": grab failed with unknown problem", ELL_WARNING);
os::Printer::log(grabCommand, "grab failed with unknown problem", ELL_WARNING);
break;
}
}
@ -455,7 +455,7 @@ bool CIrrDeviceLinux::createWindow()
}
#ifdef _DEBUG
else
os::Printer::log("Visual chosen: ", core::stringc(static_cast<u32>(VisualInfo->visualid)).c_str(), ELL_DEBUG);
os::Printer::log("Visual chosen", core::stringc(static_cast<u32>(VisualInfo->visualid)).c_str(), ELL_DEBUG);
#endif
// create color map
@ -1993,7 +1993,7 @@ Bool PredicateIsEventType(Display *display, XEvent *event, XPointer arg)
{
if ( event && event->type == *(int*)arg )
{
// os::Printer::log("remove event:", core::stringc((int)arg).c_str(), ELL_INFORMATION);
// os::Printer::log("remove event", core::stringc((int)arg).c_str(), ELL_INFORMATION);
return True;
}
return False;

View File

@ -203,7 +203,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
#endif
SDL_INIT_NOPARACHUTE ) < 0)
{
os::Printer::log( "Unable to initialize SDL!", SDL_GetError());
os::Printer::log("Unable to initialize SDL!", SDL_GetError());
Close = true;
}
else
@ -429,7 +429,7 @@ bool CIrrDeviceSDL::createWindow()
}
if ( !Screen )
{
os::Printer::log( "Could not initialize display!" );
os::Printer::log("Could not initialize display!" );
return false;
}
@ -618,7 +618,7 @@ bool CIrrDeviceSDL::run()
else
{
irrevent.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP;
MouseButtonStates &= !irr::EMBSM_RIGHT;
MouseButtonStates &= ~irr::EMBSM_RIGHT;
}
break;
@ -631,7 +631,7 @@ bool CIrrDeviceSDL::run()
else
{
irrevent.MouseInput.Event = irr::EMIE_MMOUSE_LEFT_UP;
MouseButtonStates &= !irr::EMBSM_MIDDLE;
MouseButtonStates &= ~irr::EMBSM_MIDDLE;
}
break;

View File

@ -153,6 +153,8 @@ namespace irr
virtual void setPosition(s32 x, s32 y) IRR_OVERRIDE
{
SDL_WarpMouse( x, y );
CursorPos.X = x;
CursorPos.Y = y;
}
//! Returns the current position of the mouse cursor.
@ -200,15 +202,6 @@ namespace irr
#else
CursorPos.X = Device->MouseX;
CursorPos.Y = Device->MouseY;
if (CursorPos.X < 0)
CursorPos.X = 0;
if (CursorPos.X > (s32)Device->Width)
CursorPos.X = Device->Width;
if (CursorPos.Y < 0)
CursorPos.Y = 0;
if (CursorPos.Y > (s32)Device->Height)
CursorPos.Y = Device->Height;
#endif
}

View File

@ -458,7 +458,7 @@ void CIrrMeshFileLoader::skipSection(io::IXMLReader* reader, bool reportSkipping
{
#ifdef _DEBUG
if (reportSkipping)
os::Printer::log("irrMesh unknown element:", core::stringc(reader->getNodeName()).c_str());
os::Printer::log("irrMesh unknown element", core::stringc(reader->getNodeName()).c_str());
#endif
++tagCounter;

View File

@ -1945,7 +1945,7 @@ void CLWOMeshFileLoader::readMat(u32 size)
default:
{
#ifdef LWO_READER_DEBUG
os::Printer::log("LWO loader: skipping ", core::stringc((char*)&uiType, 4));
os::Printer::log("LWO loader: skipping", core::stringc((char*)&uiType, 4));
#endif
File->seek(subsize, true);
size -= subsize;

View File

@ -199,7 +199,7 @@ bool CMD2MeshFileLoader::loadFile(io::IReadFile* file, CAnimatedMeshMD2* mesh)
if (!file->read(textureCoords, sizeof(SMD2TextureCoordinate)*header.numTexcoords))
{
delete[] textureCoords;
os::Printer::log("MD2 Loader: Error reading TextureCoords.", file->getFileName(), ELL_ERROR);
os::Printer::log("MD2 Loader: Error reading TextureCoords", file->getFileName(), ELL_ERROR);
return false;
}
@ -221,7 +221,7 @@ bool CMD2MeshFileLoader::loadFile(io::IReadFile* file, CAnimatedMeshMD2* mesh)
delete[] triangles;
delete[] textureCoords;
os::Printer::log("MD2 Loader: Error reading triangles.", file->getFileName(), ELL_ERROR);
os::Printer::log("MD2 Loader: Error reading triangles", file->getFileName(), ELL_ERROR);
return false;
}

View File

@ -242,7 +242,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr + ((sizeof(MS3DVertex) - MS3DVERTEX_NUM_PAD_BYTES) * numVertices) > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
for (u16 tmp=0; tmp<numVertices; ++tmp)
@ -273,7 +273,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr + ((sizeof(MS3DTriangle) - MS3DTRIANGLE_NUM_PAD_BYTES) * numTriangles) > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
for (u16 tmp=0; tmp<numTriangles; ++tmp)
@ -349,7 +349,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
}
@ -390,7 +390,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
@ -452,7 +452,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
@ -479,7 +479,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
@ -529,7 +529,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
@ -569,7 +569,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
@ -625,7 +625,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
}
@ -657,7 +657,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (pPtr > buffer+fileSize)
{
delete [] buffer;
os::Printer::log("Loading failed. Corrupted data found.", file->getFileName(), ELL_ERROR);
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
return false;
}
}

View File

@ -708,38 +708,45 @@ IMesh* CMeshManipulator::createMeshUniquePrimitives(IMesh* mesh) const
// not yet 32bit
IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
{
SMesh* clone = new SMesh();
clone->BoundingBox = mesh->getBoundingBox();
SMesh* meshClone = new SMesh();
meshClone->BoundingBox = mesh->getBoundingBox();
core::array<u16> redirects;
for (u32 b=0; b<mesh->getMeshBufferCount(); ++b)
{
const IMeshBuffer* const mb = mesh->getMeshBuffer(b);
const u32 vertexCount = mb->getVertexCount();
// reset redirect list
redirects.set_used(mb->getVertexCount());
redirects.set_used(vertexCount);
const u16* indices = 0;
u32 indexCount = 0;
const video::E_INDEX_TYPE indexType = mb->getIndexType();
const u16* indices = mb->getIndices();
const u32 indexCount = mb->getIndexCount();
core::array<u16>* outIdx = 0;
if ( indexType == video::EIT_32BIT )
{
IMeshBuffer* buffer = mb->createClone();
buffer->setBoundingBox(mb->getBoundingBox());
buffer->getMaterial() = mb->getMaterial();
meshClone->addMeshBuffer(buffer);
buffer->drop();
continue; // TODO: handle 32-bit buffers beside copying them
}
switch(mb->getVertexType())
{
case video::EVT_STANDARD:
{
SMeshBuffer* buffer = new SMeshBuffer();
buffer->BoundingBox = mb->getBoundingBox();
buffer->setBoundingBox(mb->getBoundingBox());
buffer->Material = mb->getMaterial();
clone->addMeshBuffer(buffer);
meshClone->addMeshBuffer(buffer);
buffer->drop();
video::S3DVertex* v =
(video::S3DVertex*)mb->getVertices();
video::S3DVertex* v = (video::S3DVertex*)mb->getVertices();
u32 vertexCount = mb->getVertexCount();
indices = mb->getIndices();
indexCount = mb->getIndexCount();
outIdx = &buffer->Indices;
buffer->Vertices.reallocate(vertexCount);
@ -771,18 +778,14 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
case video::EVT_2TCOORDS:
{
SMeshBufferLightMap* buffer = new SMeshBufferLightMap();
buffer->BoundingBox = mb->getBoundingBox();
buffer->setBoundingBox(mb->getBoundingBox());
buffer->Material = mb->getMaterial();
clone->addMeshBuffer(buffer);
meshClone->addMeshBuffer(buffer);
buffer->drop();
video::S3DVertex2TCoords* v =
(video::S3DVertex2TCoords*)mb->getVertices();
u32 vertexCount = mb->getVertexCount();
indices = mb->getIndices();
indexCount = mb->getIndexCount();
outIdx = &buffer->Indices;
buffer->Vertices.reallocate(vertexCount);
@ -814,18 +817,13 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
case video::EVT_TANGENTS:
{
SMeshBufferTangents* buffer = new SMeshBufferTangents();
buffer->BoundingBox = mb->getBoundingBox();
buffer->setBoundingBox(mb->getBoundingBox());
buffer->Material = mb->getMaterial();
clone->addMeshBuffer(buffer);
meshClone->addMeshBuffer(buffer);
buffer->drop();
video::S3DVertexTangents* v =
(video::S3DVertexTangents*)mb->getVertices();
video::S3DVertexTangents* v = (video::S3DVertexTangents*)mb->getVertices();
u32 vertexCount = mb->getVertexCount();
indices = mb->getIndices();
indexCount = mb->getIndexCount();
outIdx = &buffer->Indices;
buffer->Vertices.reallocate(vertexCount);
@ -860,7 +858,7 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
break;
}
// Clean up any degenerate tris
// set indices for new buffer
core::array<u16> &Indices = *outIdx;
Indices.clear();
Indices.reallocate(indexCount);
@ -873,6 +871,7 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
bool drop = false;
// Clean up any degenerate tris
if (a == b || b == c || a == c)
drop = true;
@ -885,8 +884,9 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
Indices.push_back(c);
}
}
// indexCount-Indices.size() vertices got welded for this meshbuffer
}
return clone;
return meshClone;
}

View File

@ -250,7 +250,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
v.Pos = vertexBuffer[Idx[0]];
else
{
os::Printer::log("Invalid vertex index in this line:", wordBuffer.c_str(), ELL_ERROR);
os::Printer::log("Invalid vertex index in this line", wordBuffer.c_str(), ELL_ERROR);
delete [] buf;
return 0;
}

View File

@ -112,7 +112,7 @@ bool CQ3LevelMesh::loadFile(io::IReadFile* file)
( header.strID != 0x50534252 || header.version != 1 ) // RBSP, starwars jedi, sof
)
{
os::Printer::log("Could not load .bsp file, unknown header.", file->getFileName(), ELL_ERROR);
os::Printer::log("Could not load .bsp file, unknown header", file->getFileName(), ELL_ERROR);
return false;
}

View File

@ -438,7 +438,7 @@ IAnimatedMesh* CSceneManager::getMesh(const io::path& filename, const io::path&
io::IReadFile* file = FileSystem->createAndOpenFile(filename);
if (!file)
{
os::Printer::log("Could not load mesh, because file could not be opened: ", filename, ELL_ERROR);
os::Printer::log("Could not load mesh, because file could not be opened", filename, ELL_ERROR);
return 0;
}
@ -2377,7 +2377,7 @@ bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* use
ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode);
if (!ret)
os::Printer::log("Could not load scene file, perhaps the format is unsupported: ", file->getFileName().c_str(), ELL_ERROR);
os::Printer::log("Could not load scene file, perhaps the format is unsupported", file->getFileName().c_str(), ELL_ERROR);
return ret;
}

View File

@ -117,7 +117,6 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
if (firstUpdate)
{
camera->updateAbsolutePosition();
if (CursorControl )
{
CursorControl->setPosition(0.5f, 0.5f);
@ -151,6 +150,7 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
LastAnimationTime = timeMs;
// Update rotation
camera->updateAbsolutePosition();
core::vector3df target = (camera->getTarget() - camera->getAbsolutePosition());
core::vector3df relativeRotation = target.getHorizontalAngle();

View File

@ -1104,27 +1104,27 @@ void CSkinnedMesh::finalize()
if ( redundantPosKeys > 0 )
{
os::Printer::log("Skinned Mesh - redundant position frames kicked:", core::stringc(redundantPosKeys).c_str(), ELL_DEBUG);
os::Printer::log("Skinned Mesh - redundant position frames kicked", core::stringc(redundantPosKeys).c_str(), ELL_DEBUG);
}
if ( unorderedPosKeys > 0 )
{
irr::os::Printer::log("Skinned Mesh - unsorted position frames kicked:", irr::core::stringc(unorderedPosKeys).c_str(), irr::ELL_DEBUG);
irr::os::Printer::log("Skinned Mesh - unsorted position frames kicked", irr::core::stringc(unorderedPosKeys).c_str(), irr::ELL_DEBUG);
}
if ( redundantScaleKeys > 0 )
{
os::Printer::log("Skinned Mesh - redundant scale frames kicked:", core::stringc(redundantScaleKeys).c_str(), ELL_DEBUG);
os::Printer::log("Skinned Mesh - redundant scale frames kicked", core::stringc(redundantScaleKeys).c_str(), ELL_DEBUG);
}
if ( unorderedScaleKeys > 0 )
{
irr::os::Printer::log("Skinned Mesh - unsorted scale frames kicked:", irr::core::stringc(unorderedScaleKeys).c_str(), irr::ELL_DEBUG);
irr::os::Printer::log("Skinned Mesh - unsorted scale frames kicked", irr::core::stringc(unorderedScaleKeys).c_str(), irr::ELL_DEBUG);
}
if ( redundantRotationKeys > 0 )
{
os::Printer::log("Skinned Mesh - redundant rotation frames kicked:", core::stringc(redundantRotationKeys).c_str(), ELL_DEBUG);
os::Printer::log("Skinned Mesh - redundant rotation frames kicked", core::stringc(redundantRotationKeys).c_str(), ELL_DEBUG);
}
if ( unorderedRotationKeys > 0 )
{
irr::os::Printer::log("Skinned Mesh - unsorted rotation frames kicked:", irr::core::stringc(unorderedRotationKeys).c_str(), irr::ELL_DEBUG);
irr::os::Printer::log("Skinned Mesh - unsorted rotation frames kicked", irr::core::stringc(unorderedRotationKeys).c_str(), irr::ELL_DEBUG);
}
}

View File

@ -265,7 +265,7 @@ namespace scene
{
if ((filesize-file->getPos())/bytesPerPixel>(size_t)(width*width))
{
os::Printer::log("Error reading heightmap RAW file", "File is too small.");
os::Printer::log("Error reading heightmap RAW file: File is too small.");
return false;
}
TerrainData.Size = width;

View File

@ -463,7 +463,7 @@ bool CWGLManager::activateContext(const SExposedVideoData& videoData, bool resto
{
if (!wglMakeCurrent((HDC)PrimaryContext.OpenGLWin32.HDc, (HGLRC)PrimaryContext.OpenGLWin32.HRc))
{
os::Printer::log("Render Context switch failed.");
os::Printer::log("Render Context switch (back to main) failed.");
return false;
}
CurrentContext=PrimaryContext;

View File

@ -491,7 +491,7 @@ bool CXMeshFileLoader::parseDataObject()
// parse specific object
#ifdef _XREADER_DEBUG
os::Printer::log("debug DataObject:", objectName.c_str(), ELL_DEBUG);
os::Printer::log("debug DataObject", objectName.c_str(), ELL_DEBUG);
#endif
if (objectName == "template")
@ -848,7 +848,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
}
#ifdef _XREADER_DEBUG
os::Printer::log("debug DataObject in mesh:", objectName.c_str(), ELL_DEBUG);
os::Printer::log("debug DataObject in mesh", objectName.c_str(), ELL_DEBUG);
#endif
if (objectName == "MeshNormals")

View File

@ -39,6 +39,8 @@ namespace os
static void print(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const wchar_t* message, ELOG_LEVEL ll = ELL_INFORMATION);
// The string ": " is added between message and hint
static void log(const c8* message, const c8* hint, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const c8* message, const io::path& hint, ELOG_LEVEL ll = ELL_INFORMATION);
static ILogger* Logger;