Merge from 1.7 branch, revisions 3449-3513. createImage fixed. Many GUI fixes. Saved particles can be loaded again. Volume light, skydome and water scene node updates. Let hw mapping hint be loaded. D3D reset fix, now terrain scenes can resize screens again.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3514 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2010-12-19 19:39:20 +00:00
parent 8f41c9bf9f
commit 1ad3c74407
36 changed files with 353 additions and 158 deletions

View File

@ -1,4 +1,4 @@
Changes in 1.8 (??.0?.2010)
Changes in 1.8 (??.??.2011)
- API change: Added write only lock mode for textures. The lock method has changed the signature and uses an enum parameter now instead of a bool. The default is still to lock for read/write (previously 'false'). The old 'true' value should be replaced by ETLM_READ_ONLY.
@ -143,14 +143,32 @@ Changes in 1.8 (??.0?.2010)
- WM_SYSCOMMAND - SC_KEYMENU message is now ignored (F10 and ALT in Win32 windowed mode)
-----------------------------
Changes maybe still for 1.7.2 - or is that out already?
Changes in 1.7.3 (??.??.2011)
- Tab-positions care now about the borders correctly
- TabControl now respositions it's tabs when setTabVerticalAlignment is changed (thx @ ceyron for reporting+testcase)
- CGUIModalScreen now no longer takes focus itself, but tries to give it first child when possible to fix modal windows losing focus all the time
- Modal screens no longer blinks when gui-elements call removeFocus on themself (thx @ yaten for reporting+testcase)
- Fix crash in multiline-editbox when selecting with mouse (thx @ ceyron for reporting and testcase)
- Q3 maps no longer crash when faces try accessing lightmaps which are not mentioned to be loaded in the file.
- Get particles saved before 1.7.2 (for example in irrEdit) working again (thx to smashly for problem reporting)
- Fix IGUIScrollBar setMax and setMin which had been restricted wrongly (reported by REDDemon)
- Fix CNullDriver::createImage - Creating the image from a texture-rectangle which doesn't start at 0,0 works now again (thx @ ceyron for bugreport+testcase)
- Menu no longer sets highlight state when clicking disabled menu-item (reported by Mloren)
- Treeview can now be disabled
-----------------------------
Changes in 1.7.2 (??.??.2010)
Changes in 1.7.2 (15.11.2010)
- Fix blend mode setup in OpenGL driver, when using the material2d override, as pointed out by Auria

View File

@ -39,6 +39,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib"
OutputFile="..\..\bin\Win32-VisualStudio\14.Win32Window.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
@ -101,6 +102,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib"
OutputFile="..\..\bin\Win32-VisualStudio\14.Win32Window.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"

View File

@ -45,8 +45,7 @@
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/LoadIrrFile.pdb"
SubSystem="1"
TargetMachine="1"/>
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/LoadIrrFile.tlb"

View File

@ -34,6 +34,7 @@
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\16.Quake3MapShader.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Quake3MapShader.pdb"

View File

@ -1935,7 +1935,7 @@ void CQuake3EventHandler::Render()
driver->beginScene(true, true, SColor(0,0,0,0));
driver->getOverrideMaterial().Material.ColorMask = ECP_NONE;
driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses = ESNRP_SKY_BOX +
driver->getOverrideMaterial().EnablePasses = ESNRP_SKY_BOX +
ESNRP_SOLID +
ESNRP_TRANSPARENT +
ESNRP_TRANSPARENT_EFFECT +
@ -1961,7 +1961,7 @@ void CQuake3EventHandler::Render()
driver->getOverrideMaterial().Material.ColorMask = ECP_RED;
driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses =
driver->getOverrideMaterial().EnablePasses =
ESNRP_SKY_BOX|ESNRP_SOLID|ESNRP_TRANSPARENT|
ESNRP_TRANSPARENT_EFFECT|ESNRP_SHADOW;
@ -1977,7 +1977,7 @@ void CQuake3EventHandler::Render()
driver->getOverrideMaterial().Material.ColorMask = ECP_GREEN + ECP_BLUE;
driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses =
driver->getOverrideMaterial().EnablePasses =
ESNRP_SKY_BOX|ESNRP_SOLID|ESNRP_TRANSPARENT|
ESNRP_TRANSPARENT_EFFECT|ESNRP_SHADOW;

View File

@ -103,6 +103,26 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo\Demo.vcproj",
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "18.SplitScreen", "18.SplitScreen\SplitScreen.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "23.SMeshHandling", "23.SMeshHandling\SMeshHandling.vcproj", "{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "22.MaterialViewer", "22.MaterialViewer\MaterialViewer.vcproj", "{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUI Editor", "..\tools\GUIEditor\GUI Editor_v7.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "..\tools\IrrFontTool\newFontTool\irrFontTool_v7.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@ -191,6 +211,26 @@ Global
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.Build.0 = Debug|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.ActiveCfg = Release|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.Build.0 = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.Build.0 = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.Build.0 = Release|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Debug.ActiveCfg = Debug|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Debug.Build.0 = Debug|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Release.ActiveCfg = Release|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Release.Build.0 = Release|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Debug.ActiveCfg = Debug|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Debug.Build.0 = Debug|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Release.ActiveCfg = Release|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Release.Build.0 = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.ActiveCfg = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.Build.0 = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.ActiveCfg = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.Build.0 = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.ActiveCfg = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.Build.0 = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.ActiveCfg = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

View File

@ -95,7 +95,7 @@ public:
//! copies this surface into another, scaling it to fit, appyling a box filter
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
//! fills the surface with black or white
//! fills the surface with given color
virtual void fill(const SColor &color) =0;
//! get the amount of Bits per Pixel of the given color format

View File

@ -12,6 +12,7 @@ namespace irr
namespace video
{
class IMaterialRendererServices;
class SMaterial;
//! Interface making it possible to set constants for gpu programs every frame.
/** Implement this interface in an own class and pass a pointer to it to one of

View File

@ -7,7 +7,7 @@
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" href="doxygen.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<!-- (c) 2005-2008 by N.Gebhardt -->
<!-- (c) 2005-2010 by N.Gebhardt -->
</head>
<body>
<div align="center"><br/>

View File

@ -1022,58 +1022,55 @@ bool CD3D9Driver::updateVertexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
const u32 vertexCount=mb->getVertexCount();
const E_VERTEX_TYPE vType=mb->getVertexType();
const u32 vertexSize = getVertexPitchFromType(vType);
const u32 bufSize = vertexSize * vertexCount;
void* pLockedBuffer = 0;
if (!hwBuffer->vertexBuffer || vertexSize * vertexCount > hwBuffer->vertexBufferSize)
if (!hwBuffer->vertexBuffer || (bufSize > hwBuffer->vertexBufferSize))
{
DWORD flags = 0;
if (hwBuffer->vertexBuffer)
{
hwBuffer->vertexBuffer->Release();
hwBuffer->vertexBuffer=0;
}
u32 vertexSize;
DWORD FVF;
// Get the vertex sizes and cvf
switch (vType)
{
case EVT_STANDARD:
vertexSize = sizeof(S3DVertex);
FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1;
break;
case EVT_2TCOORDS:
vertexSize = sizeof(S3DVertex2TCoords);
FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX2;
break;
case EVT_TANGENTS:
vertexSize = sizeof(S3DVertexTangents);
FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX3;
break;
default:
return false;
}
flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
DWORD flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
if(hwBuffer->Mapped_Vertex != scene::EHM_STATIC)
flags |= D3DUSAGE_DYNAMIC;
pID3DDevice->CreateVertexBuffer(vertexCount * vertexSize, flags, FVF, D3DPOOL_DEFAULT, &hwBuffer->vertexBuffer, NULL);
if(!hwBuffer->vertexBuffer)
if (FAILED(pID3DDevice->CreateVertexBuffer(bufSize, flags, FVF, D3DPOOL_DEFAULT, &hwBuffer->vertexBuffer, NULL)))
return false;
hwBuffer->vertexBufferSize = bufSize;
flags = 0; // SIO2: Reset flags before Lock
if(hwBuffer->Mapped_Vertex != scene::EHM_STATIC)
flags = D3DLOCK_DISCARD;
hwBuffer->vertexBuffer->Lock(0, vertexCount * vertexSize, (void**)&pLockedBuffer, flags);
memcpy(pLockedBuffer, vertices, vertexCount * vertexSize);
void* lockedBuffer = 0;
hwBuffer->vertexBuffer->Lock(0, bufSize, (void**)&lockedBuffer, flags);
memcpy(lockedBuffer, vertices, bufSize);
hwBuffer->vertexBuffer->Unlock();
hwBuffer->vertexBufferSize = vertexCount * vertexSize;
}
else
{
hwBuffer->vertexBuffer->Lock(0, vertexCount * vertexSize, (void**)&pLockedBuffer, D3DLOCK_DISCARD);
memcpy(pLockedBuffer, vertices, vertexCount * vertexSize);
void* lockedBuffer = 0;
hwBuffer->vertexBuffer->Lock(0, bufSize, (void**)&lockedBuffer, D3DLOCK_DISCARD);
memcpy(lockedBuffer, vertices, bufSize);
hwBuffer->vertexBuffer->Unlock();
}
@ -1093,13 +1090,13 @@ bool CD3D9Driver::updateIndexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
D3DFORMAT indexType=D3DFMT_UNKNOWN;
switch (mb->getIndexType())
{
case (EIT_16BIT):
case EIT_16BIT:
{
indexType=D3DFMT_INDEX16;
indexSize = 2;
break;
}
case (EIT_32BIT):
case EIT_32BIT:
{
indexType=D3DFMT_INDEX32;
indexSize = 4;
@ -1107,37 +1104,41 @@ bool CD3D9Driver::updateIndexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
}
}
if (!hwBuffer->indexBuffer || indexSize * indexCount > hwBuffer->indexBufferSize)
const u32 bufSize = indexSize * indexCount;
if (!hwBuffer->indexBuffer || (bufSize > hwBuffer->indexBufferSize))
{
DWORD flags = 0;
if (hwBuffer->indexBuffer)
{
hwBuffer->indexBuffer->Release();
hwBuffer->indexBuffer=0;
}
flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
if(hwBuffer->Mapped_Index != scene::EHM_STATIC)
DWORD flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
if (hwBuffer->Mapped_Index != scene::EHM_STATIC)
flags |= D3DUSAGE_DYNAMIC; // SIO2: Add DYNAMIC flag for dynamic buffer data
if(FAILED(pID3DDevice->CreateIndexBuffer( indexCount * indexSize, flags, indexType, D3DPOOL_DEFAULT, &hwBuffer->indexBuffer, NULL)))
if (FAILED(pID3DDevice->CreateIndexBuffer(bufSize, flags, indexType, D3DPOOL_DEFAULT, &hwBuffer->indexBuffer, NULL)))
return false;
void* pIndices = 0;
flags = 0; // SIO2: Reset flags before Lock
if(hwBuffer->Mapped_Index != scene::EHM_STATIC)
if (hwBuffer->Mapped_Index != scene::EHM_STATIC)
flags = D3DLOCK_DISCARD;
if(FAILED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&pIndices, flags)))
void* lockedBuffer = 0;
if (FAILED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&lockedBuffer, flags)))
return false;
memcpy(pIndices, indices, indexCount * indexSize);
memcpy(lockedBuffer, indices, bufSize);
hwBuffer->indexBuffer->Unlock();
hwBuffer->indexBufferSize = indexCount * indexSize;
hwBuffer->indexBufferSize = bufSize;
}
else
{
void* pIndices = 0;
if( SUCCEEDED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&pIndices, D3DLOCK_DISCARD)))
void* lockedBuffer = 0;
if( SUCCEEDED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&lockedBuffer, D3DLOCK_DISCARD)))
{
memcpy(pIndices, indices, indexCount * indexSize);
memcpy(lockedBuffer, indices, bufSize);
hwBuffer->indexBuffer->Unlock();
}
}
@ -1157,7 +1158,6 @@ bool CD3D9Driver::updateHardwareBuffer(SHWBufferLink *hwBuffer)
if (hwBuffer->ChangedID_Vertex != hwBuffer->MeshBuffer->getChangedID_Vertex()
|| !((SHWBufferLink_d3d9*)hwBuffer)->vertexBuffer)
{
hwBuffer->ChangedID_Vertex = hwBuffer->MeshBuffer->getChangedID_Vertex();
if (!updateVertexHardwareBuffer((SHWBufferLink_d3d9*)hwBuffer))
@ -1170,7 +1170,6 @@ bool CD3D9Driver::updateHardwareBuffer(SHWBufferLink *hwBuffer)
if (hwBuffer->ChangedID_Index != hwBuffer->MeshBuffer->getChangedID_Index()
|| !((SHWBufferLink_d3d9*)hwBuffer)->indexBuffer)
{
hwBuffer->ChangedID_Index = hwBuffer->MeshBuffer->getChangedID_Index();
if (!updateIndexHardwareBuffer((SHWBufferLink_d3d9*)hwBuffer))
@ -1215,7 +1214,8 @@ CD3D9Driver::SHWBufferLink *CD3D9Driver::createHardwareBuffer(const scene::IMesh
void CD3D9Driver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer)
{
if (!_HWBuffer) return;
if (!_HWBuffer)
return;
SHWBufferLink_d3d9 *HWBuffer=(SHWBufferLink_d3d9*)_HWBuffer;
if (HWBuffer->indexBuffer)
@ -1249,8 +1249,10 @@ void CD3D9Driver::drawHardwareBuffer(SHWBufferLink *_HWBuffer)
const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer;
const E_VERTEX_TYPE vType = mb->getVertexType();
const u32 stride = getVertexPitchFromType(vType);
if (HWBuffer->vertexBuffer) pID3DDevice->SetStreamSource(0, HWBuffer->vertexBuffer, 0, stride);
if (HWBuffer->indexBuffer) pID3DDevice->SetIndices(HWBuffer->indexBuffer);
if (HWBuffer->vertexBuffer)
pID3DDevice->SetStreamSource(0, HWBuffer->vertexBuffer, 0, stride);
if (HWBuffer->indexBuffer)
pID3DDevice->SetIndices(HWBuffer->indexBuffer);
drawVertexPrimitiveList(0, mb->getVertexCount(), 0, mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType());

View File

@ -49,6 +49,7 @@ CDefaultSceneNodeFactory::CDefaultSceneNodeFactory(ISceneManager* mgr)
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_BILLBOARD, "billBoard"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_ANIMATED_MESH, "animatedMesh"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_PARTICLE_SYSTEM, "particleSystem"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_VOLUME_LIGHT, "volumeLight"));
// SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_MD3_SCENE_NODE, "md3"));
// legacy, for version <= 1.4.x irr files
@ -108,6 +109,8 @@ ISceneNode* CDefaultSceneNodeFactory::addSceneNode(ESCENE_NODE_TYPE type, IScene
core::vector3df(), core::vector3df(1,1,1), true);
case ESNT_PARTICLE_SYSTEM:
return Manager->addParticleSystemSceneNode(true, parent);
case ESNT_VOLUME_LIGHT:
return (ISceneNode*)Manager->addVolumeLightSceneNode(parent);
default:
break;
}

View File

@ -1056,7 +1056,7 @@ s32 CGUIEditBox::getCursorPos(s32 x, s32 y)
if (x < CurrentTextRect.UpperLeftCorner.X)
x = CurrentTextRect.UpperLeftCorner.X;
s32 idx = font->getCharacterFromPos(Text.c_str(), x - CurrentTextRect.UpperLeftCorner.X);
s32 idx = txtLine ? font->getCharacterFromPos(txtLine->c_str(), x - CurrentTextRect.UpperLeftCorner.X) : -1;
// click was on or left of the line
if (idx != -1)

View File

@ -162,7 +162,7 @@ void CGUIListBox::recalculateItemHeight()
}
TotalItemHeight = ItemHeight * Items.size();
ScrollBar->setMax(TotalItemHeight - AbsoluteRect.getHeight());
ScrollBar->setMax( core::max_(0, TotalItemHeight - AbsoluteRect.getHeight()) );
s32 minItemHeight = ItemHeight > 0 ? ItemHeight : 1;
ScrollBar->setSmallStep ( minItemHeight );
ScrollBar->setLargeStep ( 2*minItemHeight );

View File

@ -88,14 +88,27 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
case EGET_ELEMENT_FOCUSED:
if ( !canTakeFocus(event.GUIEvent.Caller))
{
Environment->setFocus(this);
if ( !Children.empty() )
Environment->setFocus(*(Children.begin()));
else
Environment->setFocus(this);
}
IGUIElement::OnEvent(event);
return false;
case EGET_ELEMENT_FOCUS_LOST:
if ( !canTakeFocus(event.GUIEvent.Element))
{
MouseDownTime = os::Timer::getTime();
if ( isMyChild(event.GUIEvent.Caller) )
{
if ( !Children.empty() )
Environment->setFocus(*(Children.begin()));
else
Environment->setFocus(this);
}
else
{
MouseDownTime = os::Timer::getTime();
}
return true;
}
else
@ -118,7 +131,7 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
break;
}
IGUIElement::OnEvent(event);
IGUIElement::OnEvent(event); // anyone knows why events are passed on here? Causes p.e. problems when this is child of a CGUIWindow.
return true; // absorb everything else
}

View File

@ -406,7 +406,9 @@ s32 CGUIScrollBar::getMax() const
//! sets the maximum value of the scrollbar.
void CGUIScrollBar::setMax(s32 max)
{
Max = core::max_ ( max, Min );
Max = max;
if ( Min > Max )
Min = Max;
bool enable = core::isnotzero ( range() );
UpButton->setEnabled(enable);
@ -424,7 +426,10 @@ s32 CGUIScrollBar::getMin() const
//! sets the minimum value of the scrollbar.
void CGUIScrollBar::setMin(s32 min)
{
Min = core::min_ ( min, Max );
Min = min;
if ( Max < Min )
Max = Min;
bool enable = core::isnotzero ( range() );
UpButton->setEnabled(enable);

View File

@ -309,15 +309,15 @@ void CGUIStaticText::breakText()
if (word.size())
{
// here comes the next whitespace, look if
// we can break the last word to the next line.
s32 whitelgth = font->getDimension(whitespace.c_str()).Width;
s32 worldlgth = font->getDimension(word.c_str()).Width;
// we must break the last word to the next line.
const s32 whitelgth = font->getDimension(whitespace.c_str()).Width;
const s32 wordlgth = font->getDimension(word.c_str()).Width;
if (length + worldlgth + whitelgth > elWidth)
if (length && (length + wordlgth + whitelgth > elWidth))
{
// break to next line
length = worldlgth;
BrokenText.push_back(line);
length = wordlgth;
line = word;
}
else
@ -325,7 +325,7 @@ void CGUIStaticText::breakText()
// add word to line
line += whitespace;
line += word;
length += whitelgth + worldlgth;
length += whitelgth + wordlgth;
}
word = L"";

View File

@ -258,25 +258,7 @@ IGUITab* CGUITabControl::addTab(const wchar_t* caption, s32 id)
if (!skin)
return 0;
core::rect<s32> r;
if ( VerticalAlignment == EGUIA_UPPERLEFT )
{
r.UpperLeftCorner.X = 1;
r.UpperLeftCorner.Y = TabHeight;
r.LowerRightCorner.X = AbsoluteRect.getWidth()-1;
r.LowerRightCorner.Y = AbsoluteRect.getHeight()-1;
}
else
{
r.UpperLeftCorner.X = 1;
r.UpperLeftCorner.Y = 1;
r.LowerRightCorner.X = AbsoluteRect.getWidth()-1;
r.LowerRightCorner.Y = AbsoluteRect.getHeight()-TabHeight;
}
CGUITab* tab = new CGUITab(Tabs.size(), Environment, this, r, id);
CGUITab* tab = new CGUITab(Tabs.size(), Environment, this, calcTabPos(), id);
tab->setText(caption);
tab->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
@ -544,6 +526,40 @@ bool CGUITabControl::selectTab(core::position2d<s32> p)
}
core::rect<s32> CGUITabControl::calcTabPos()
{
core::rect<s32> r;
r.UpperLeftCorner.X = 0;
r.LowerRightCorner.X = AbsoluteRect.getWidth();
if ( Border )
{
++r.UpperLeftCorner.X;
--r.LowerRightCorner.X;
}
if ( VerticalAlignment == EGUIA_UPPERLEFT )
{
r.UpperLeftCorner.Y = TabHeight+2;
r.LowerRightCorner.Y = AbsoluteRect.getHeight()-1;
if ( Border )
{
--r.LowerRightCorner.Y;
}
}
else
{
r.UpperLeftCorner.Y = 0;
r.LowerRightCorner.Y = AbsoluteRect.getHeight()-(TabHeight+2);
if ( Border )
{
++r.UpperLeftCorner.Y;
}
}
return r;
}
//! draws the element and its children
void CGUITabControl::draw()
{
@ -793,6 +809,12 @@ void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment )
recalculateScrollButtonPlacement();
recalculateScrollBar();
core::rect<s32> r(calcTabPos());
for ( u32 i=0; i<Tabs.size(); ++i )
{
Tabs[i]->setRelativePosition(r);
}
}
void CGUITabControl::recalculateScrollButtonPlacement()

View File

@ -161,6 +161,7 @@ namespace gui
void scrollRight();
bool needScrollControl( s32 startIndex=0, bool withScrollControl=false );
s32 calcTabWidth(s32 pos, IGUIFont* font, const wchar_t* text, bool withScrollControl );
core::rect<s32> calcTabPos();
void recalculateScrollButtonPlacement();
void recalculateScrollBar();

View File

@ -457,7 +457,7 @@ void CGUITable::checkScrollbars()
{
clientClip.LowerRightCorner.Y -= scrollBarSize;
HorizontalScrollBar->setVisible(true);
HorizontalScrollBar->setMax(TotalItemWidth - clientClip.getWidth());
HorizontalScrollBar->setMax(core::max_(0,TotalItemWidth - clientClip.getWidth()));
}
// needs vertical scroll be visible?
@ -465,7 +465,7 @@ void CGUITable::checkScrollbars()
{
clientClip.LowerRightCorner.X -= scrollBarSize;
VerticalScrollBar->setVisible(true);
VerticalScrollBar->setMax(TotalItemHeight - clientClip.getHeight());
VerticalScrollBar->setMax(core::max_(0,TotalItemHeight - clientClip.getHeight()));
// check horizontal again because we have now smaller clientClip
if ( !HorizontalScrollBar->isVisible() )
@ -474,7 +474,7 @@ void CGUITable::checkScrollbars()
{
clientClip.LowerRightCorner.Y -= scrollBarSize;
HorizontalScrollBar->setVisible(true);
HorizontalScrollBar->setMax(TotalItemWidth - clientClip.getWidth());
HorizontalScrollBar->setMax(core::max_(0,TotalItemWidth - clientClip.getWidth()));
}
}
}

View File

@ -583,10 +583,10 @@ void CGUITreeView::recalculateItemHeight()
}
if ( ScrollBarV )
ScrollBarV->setMax( TotalItemHeight - AbsoluteRect.getHeight() );
ScrollBarV->setMax( core::max_(0,TotalItemHeight - AbsoluteRect.getHeight()) );
if ( ScrollBarH )
ScrollBarH->setMax( TotalItemWidth - AbsoluteRect.getWidth() );
ScrollBarH->setMax( core::max_(0, TotalItemWidth - AbsoluteRect.getWidth()) );
}

View File

@ -100,7 +100,7 @@ public:
//! copies this surface into another, scaling it to fit, appyling a box filter
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false);
//! fills the surface with black or white
//! fills the surface with given color
virtual void fill(const SColor &color);
//! draws a rectangle

View File

@ -33,7 +33,6 @@ CMeshSceneNode::CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* m
}
//! destructor
CMeshSceneNode::~CMeshSceneNode()
{
@ -42,7 +41,6 @@ CMeshSceneNode::~CMeshSceneNode()
}
//! frame
void CMeshSceneNode::OnRegisterSceneNode()
{
@ -110,7 +108,6 @@ void CMeshSceneNode::OnRegisterSceneNode()
}
//! renders the node.
void CMeshSceneNode::render()
{
@ -232,7 +229,7 @@ void CMeshSceneNode::render()
for (u32 g=0; g<Mesh->getMeshBufferCount(); ++g)
{
driver->drawMeshBuffer( Mesh->getMeshBuffer(g) );
driver->drawMeshBuffer(Mesh->getMeshBuffer(g));
}
}
}
@ -255,8 +252,8 @@ video::SMaterial& CMeshSceneNode::getMaterial(u32 i)
{
if (Mesh && ReadOnlyMaterials && i<Mesh->getMeshBufferCount())
{
tmpReadOnlyMaterial = Mesh->getMeshBuffer(i)->getMaterial();
return tmpReadOnlyMaterial;
ReadOnlyMaterial = Mesh->getMeshBuffer(i)->getMaterial();
return ReadOnlyMaterial;
}
if (i >= Materials.size())
@ -266,7 +263,6 @@ video::SMaterial& CMeshSceneNode::getMaterial(u32 i)
}
//! returns amount of materials used by this scene node.
u32 CMeshSceneNode::getMaterialCount() const
{
@ -277,19 +273,18 @@ u32 CMeshSceneNode::getMaterialCount() const
}
//! Sets a new mesh
void CMeshSceneNode::setMesh(IMesh* mesh)
{
if (!mesh)
return; // won't set null mesh
if (mesh)
{
mesh->grab();
if (Mesh)
Mesh->drop();
mesh->grab();
if (Mesh)
Mesh->drop();
Mesh = mesh;
copyMaterials();
Mesh = mesh;
copyMaterials();
}
}
@ -322,6 +317,7 @@ void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeRea
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
}
//! Reads attributes of the scene node.
void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
@ -341,9 +337,38 @@ void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
setMesh(newMesh);
}
// optional attribute to assign the hint to the whole mesh
if (in->existsAttribute("HardwareMappingHint") &&
in->existsAttribute("HardwareMappingBufferType"))
{
scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;
scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;
core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");
if (smapping.equals_ignore_case("static"))
mapping = scene::EHM_STATIC;
else if (smapping.equals_ignore_case("dynamic"))
mapping = scene::EHM_DYNAMIC;
else if (smapping.equals_ignore_case("stream"))
mapping = scene::EHM_STREAM;
core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");
if (sbufferType.equals_ignore_case("vertex"))
bufferType = scene::EBT_VERTEX;
else if (sbufferType.equals_ignore_case("index"))
bufferType = scene::EBT_INDEX;
else if (sbufferType.equals_ignore_case("vertexindex"))
bufferType = scene::EBT_VERTEX_AND_INDEX;
IMesh* mesh = getMesh();
if (mesh)
mesh->setHardwareMappingHint(mapping, bufferType);
}
IMeshSceneNode::deserializeAttributes(in, options);
}
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
@ -352,6 +377,7 @@ void CMeshSceneNode::setReadOnlyMaterials(bool readonly)
ReadOnlyMaterials = readonly;
}
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
bool CMeshSceneNode::isReadOnlyMaterials() const
{
@ -362,8 +388,10 @@ bool CMeshSceneNode::isReadOnlyMaterials() const
//! Creates a clone of this scene node and its children.
ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{
if (!newParent) newParent = Parent;
if (!newManager) newManager = SceneManager;
if (!newParent)
newParent = Parent;
if (!newManager)
newManager = SceneManager;
CMeshSceneNode* nb = new CMeshSceneNode(Mesh, newParent,
newManager, ID, RelativeTranslation, RelativeRotation, RelativeScale);
@ -372,13 +400,12 @@ ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
nb->ReadOnlyMaterials = ReadOnlyMaterials;
nb->Materials = Materials;
if ( newParent )
if (newParent)
nb->drop();
return nb;
}
} // end namespace scene
} // end namespace irr

View File

@ -77,7 +77,7 @@ namespace scene
core::array<video::SMaterial> Materials;
core::aabbox3d<f32> Box;
video::SMaterial tmpReadOnlyMaterial;
video::SMaterial ReadOnlyMaterial;
IMesh* Mesh;

View File

@ -434,7 +434,7 @@ ITexture* CNullDriver::getTexture(const io::path& filename)
// Now try to open the file using the complete path.
io::IReadFile* file = FileSystem->createAndOpenFile(absolutePath);
if(!file)
if (!file)
{
// Try to open it using the raw filename.
file = FileSystem->createAndOpenFile(filename);
@ -489,10 +489,10 @@ ITexture* CNullDriver::getTexture(io::IReadFile* file)
addTexture(texture);
texture->drop(); // drop it because we created it, one grab too much
}
}
if (!texture)
os::Printer::log("Could not load texture", file->getFileName(), ELL_WARNING);
if (!texture)
os::Printer::log("Could not load texture", file->getFileName(), ELL_WARNING);
}
return texture;
}
@ -1462,7 +1462,8 @@ IImage* CNullDriver::createImage(ITexture* texture, const core::position2d<s32>&
return 0;
IImage* image = new CImage(texture->getColorFormat(), clamped.getSize());
u8* dst = static_cast<u8*>(image->lock());
for (u32 i=clamped.UpperLeftCorner.Y; i<clamped.getHeight(); ++i)
src += clamped.UpperLeftCorner.Y * texture->getPitch() + image->getBytesPerPixel() * clamped.UpperLeftCorner.X;
for (u32 i=0; i<clamped.getHeight(); ++i)
{
video::CColorConverter::convert_viaFormat(src, texture->getColorFormat(), clamped.getWidth(), dst, image->getColorFormat());
src += texture->getPitch();

View File

@ -158,7 +158,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
GLuint PixelFormat;
for (u32 i=0; i<5; ++i)
for (u32 i=0; i<6; ++i)
{
if (i == 1)
{

View File

@ -148,10 +148,19 @@ void CParticleBoxEmitter::deserializeAttributes(io::IAttributes* in, io::SAttrib
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
int idx = -1;
idx = in->findAttribute("MinStartSizeWidth");
if ( idx >= 0 )
MinStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MinStartSizeHeight");
if ( idx >= 0 )
MinStartSize.Height = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeWidth");
if ( idx >= 0 )
MaxStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeHeight");
if ( idx >= 0 )
MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");

View File

@ -149,10 +149,19 @@ void CParticleCylinderEmitter::deserializeAttributes(io::IAttributes* in, io::SA
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
int idx = -1;
idx = in->findAttribute("MinStartSizeWidth");
if ( idx >= 0 )
MinStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MinStartSizeHeight");
if ( idx >= 0 )
MinStartSize.Height = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeWidth");
if ( idx >= 0 )
MaxStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeHeight");
if ( idx >= 0 )
MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");

View File

@ -108,10 +108,19 @@ void CParticlePointEmitter::deserializeAttributes(io::IAttributes* in, io::SAttr
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
int idx = -1;
idx = in->findAttribute("MinStartSizeWidth");
if ( idx >= 0 )
MinStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MinStartSizeHeight");
if ( idx >= 0 )
MinStartSize.Height = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeWidth");
if ( idx >= 0 )
MaxStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeHeight");
if ( idx >= 0 )
MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");

View File

@ -139,10 +139,19 @@ void CParticleRingEmitter::deserializeAttributes(io::IAttributes* in, io::SAttri
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
int idx = -1;
idx = in->findAttribute("MinStartSizeWidth");
if ( idx >= 0 )
MinStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MinStartSizeHeight");
if ( idx >= 0 )
MinStartSize.Height = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeWidth");
if ( idx >= 0 )
MaxStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeHeight");
if ( idx >= 0 )
MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");

View File

@ -138,11 +138,19 @@ void CParticleSphereEmitter::deserializeAttributes(io::IAttributes* in, io::SAtt
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
int idx = -1;
idx = in->findAttribute("MinStartSizeWidth");
if ( idx >= 0 )
MinStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MinStartSizeHeight");
if ( idx >= 0 )
MinStartSize.Height = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeWidth");
if ( idx >= 0 )
MaxStartSize.Width = in->getAttributeAsFloat(idx);
idx = in->findAttribute("MaxStartSizeHeight");
if ( idx >= 0 )
MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");

View File

@ -27,9 +27,10 @@ namespace scene
//! constructor
CQ3LevelMesh::CQ3LevelMesh(io::IFileSystem* fs, scene::ISceneManager* smgr,
const Q3LevelLoadParameter &loadParam)
: LoadParam(loadParam), Textures(0), LightMaps(0),
Vertices(0), Faces(0), Planes(0), Nodes(0), Leafs(0), LeafFaces(0),
MeshVerts(0), Brushes(0), FileSystem(fs), SceneManager(smgr)
: LoadParam(loadParam), Textures(0), NumTextures(0), LightMaps(0), NumLightMaps(0),
Vertices(0), NumVertices(0), Faces(0), NumFaces(0), Planes(0), NumPlanes(0),
Nodes(0), NumNodes(0), Leafs(0), NumLeafs(0), LeafFaces(0), NumLeafFaces(0),
MeshVerts(0), NumMeshVerts(0), Brushes(0), NumBrushes(0), FileSystem(fs), SceneManager(smgr)
{
#ifdef _DEBUG
IReferenceCounted::setDebugName("CQ3LevelMesh");
@ -197,6 +198,8 @@ IMesh* CQ3LevelMesh::getMesh(s32 frameInMs, s32 detailLevel, s32 startFrameLoop,
void CQ3LevelMesh::loadTextures(tBSPLump* l, io::IReadFile* file)
{
NumTextures = l->length / sizeof(tBSPTexture);
if ( !NumTextures )
return;
Textures = new tBSPTexture[NumTextures];
file->seek(l->offset);
@ -217,6 +220,8 @@ void CQ3LevelMesh::loadTextures(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadLightmaps(tBSPLump* l, io::IReadFile* file)
{
NumLightMaps = l->length / sizeof(tBSPLightmap);
if ( !NumLightMaps )
return;
LightMaps = new tBSPLightmap[NumLightMaps];
file->seek(l->offset);
@ -228,6 +233,8 @@ void CQ3LevelMesh::loadLightmaps(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadVerts(tBSPLump* l, io::IReadFile* file)
{
NumVertices = l->length / sizeof(tBSPVertex);
if ( !NumVertices )
return;
Vertices = new tBSPVertex[NumVertices];
file->seek(l->offset);
@ -255,6 +262,8 @@ void CQ3LevelMesh::loadVerts(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadFaces(tBSPLump* l, io::IReadFile* file)
{
NumFaces = l->length / sizeof(tBSPFace);
if (!NumFaces)
return;
Faces = new tBSPFace[NumFaces];
file->seek(l->offset);
@ -395,6 +404,8 @@ void CQ3LevelMesh::loadModels(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadMeshVerts(tBSPLump* l, io::IReadFile* file)
{
NumMeshVerts = l->length / sizeof(s32);
if (!NumMeshVerts)
return;
MeshVerts = new s32[NumMeshVerts];
file->seek(l->offset);
@ -718,13 +729,13 @@ s32 CQ3LevelMesh::setShaderMaterial( video::SMaterial &material, const tBSPFace
s32 shaderState = -1;
if ( face->textureID >= 0 )
if ( face->textureID >= 0 && face->textureID < (s32)Tex.size() )
{
material.setTexture(0, Tex [ face->textureID ].Texture);
shaderState = Tex [ face->textureID ].ShaderID;
}
if ( face->lightmapID >= 0 )
if ( face->lightmapID >= 0 && face->lightmapID < (s32)Lightmap.size() )
{
material.setTexture(1, Lightmap [ face->lightmapID ]);
material.MaterialType = LoadParam.defaultLightMapMaterial;
@ -1834,7 +1845,7 @@ void CQ3LevelMesh::loadTextures()
s32 t;
// load lightmaps.
Lightmap.set_used(NumLightMaps+1);
Lightmap.set_used(NumLightMaps);
/*
bool oldMipMapState = Driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
@ -1859,7 +1870,7 @@ void CQ3LevelMesh::loadTextures()
// Driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
// load textures
Tex.set_used( NumTextures+1 );
Tex.set_used( NumTextures );
const IShader* shader;

View File

@ -588,9 +588,6 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight,
ISceneNode* parent, s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{
if (!mesh)
return 0;
if (!parent)
parent = this;

View File

@ -53,9 +53,6 @@ CSkyDomeSceneNode::CSkyDomeSceneNode(video::ITexture* sky, u32 horiRes, u32 vert
Buffer->BoundingBox.MaxEdge.set(0,0,0);
Buffer->BoundingBox.MinEdge.set(0,0,0);
Buffer->Vertices.clear();
Buffer->Indices.clear();
// regenerate the mesh
generateMesh();
}
@ -73,6 +70,9 @@ void CSkyDomeSceneNode::generateMesh()
f32 azimuth;
u32 k;
Buffer->Vertices.clear();
Buffer->Indices.clear();
const f32 azimuth_step = (core::PI * 2.f) / HorizontalResolution;
if (SpherePercentage < 0.f)
SpherePercentage = -SpherePercentage;

View File

@ -44,7 +44,7 @@ namespace scene
virtual u32 getMaterialCount() const;
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const { return ESNT_CUBE; }
virtual ESCENE_NODE_TYPE getType() const { return ESNT_VOLUME_LIGHT; }
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;

View File

@ -29,13 +29,13 @@ CWaterSurfaceSceneNode::CWaterSurfaceSceneNode(f32 waveHeight, f32 waveSpeed, f3
#endif
// create copy of the mesh
if (!mesh)
return;
// Mesh is set in CMeshSceneNode constructor, now it is moved to OriginalMesh
IMesh* clone = SceneManager->getMeshManipulator()->createMeshCopy(mesh);
OriginalMesh = Mesh;
Mesh = clone;
if (mesh)
{
// Mesh is set in CMeshSceneNode constructor, now it is moved to OriginalMesh
IMesh* clone = SceneManager->getMeshManipulator()->createMeshCopy(mesh);
OriginalMesh = Mesh;
Mesh = clone;
}
}

View File

@ -273,6 +273,8 @@ bool CXMeshFileLoader::load(io::IReadFile* file)
// init with 0
for (i=0;i<mesh->Vertices.size();++i)
{
// watch out for vertices which are not part of the mesh
// they will keep the -1 and can lead to out-of-bounds access
verticesLinkBuffer[i]=-1;
}
@ -305,7 +307,10 @@ bool CXMeshFileLoader::load(io::IReadFile* file)
memset(vCountArray, 0, mesh->Buffers.size()*sizeof(u32));
// count vertices in each buffer and reallocate
for (i=0; i<mesh->Vertices.size(); ++i)
++vCountArray[verticesLinkBuffer[i]];
{
if (verticesLinkBuffer[i] != -1)
++vCountArray[verticesLinkBuffer[i]];
}
if (mesh->TCoords2.size())
{
for (i=0; i!=mesh->Buffers.size(); ++i)
@ -324,6 +329,9 @@ bool CXMeshFileLoader::load(io::IReadFile* file)
// actually store vertices
for (i=0; i<mesh->Vertices.size(); ++i)
{
// if a vertex is missing for some reason, just skip it
if (verticesLinkBuffer[i]==-1)
continue;
scene::SSkinMeshBuffer *buffer = mesh->Buffers[ verticesLinkBuffer[i] ];
if (mesh->TCoords2.size())