mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Merging r6196 through r6248 from trunk to ogl-es branch
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6249 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -698,12 +698,6 @@ bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
|
||||
if (CurrentTexture[stage] == texture)
|
||||
return true;
|
||||
|
||||
if (texture && texture->getDriverType() != EDT_DIRECT3D9)
|
||||
{
|
||||
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
CurrentTexture[stage] = texture;
|
||||
|
||||
if (!texture)
|
||||
@ -711,13 +705,20 @@ bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
|
||||
pID3DDevice->SetTexture(stage, 0);
|
||||
pID3DDevice->SetTextureStageState( stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
|
||||
}
|
||||
else
|
||||
else if (texture->getDriverType() == EDT_DIRECT3D9)
|
||||
{
|
||||
pID3DDevice->SetTexture(stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
|
||||
|
||||
if (stage <= 4)
|
||||
if (((const CD3D9Texture*)texture)->HasVertexTextureSupport() && stage < 4 )
|
||||
pID3DDevice->SetTexture(D3DVERTEXTEXTURESAMPLER0 + stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
|
||||
setActiveTexture(stage, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -909,13 +910,6 @@ void CD3D9Driver::setViewPort(const core::rect<s32>& area)
|
||||
}
|
||||
|
||||
|
||||
//! gets the area of the current viewport
|
||||
const core::rect<s32>& CD3D9Driver::getViewPort() const
|
||||
{
|
||||
return ViewPort;
|
||||
}
|
||||
|
||||
|
||||
bool CD3D9Driver::updateVertexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
|
||||
{
|
||||
if (!hwBuffer)
|
||||
|
@ -64,9 +64,6 @@ namespace video
|
||||
//! sets a viewport
|
||||
virtual void setViewPort(const core::rect<s32>& area) _IRR_OVERRIDE_;
|
||||
|
||||
//! gets the area of the current viewport
|
||||
virtual const core::rect<s32>& getViewPort() const _IRR_OVERRIDE_;
|
||||
|
||||
struct SHWBufferLink_d3d9 : public SHWBufferLink
|
||||
{
|
||||
SHWBufferLink_d3d9(const scene::IMeshBuffer *_MeshBuffer):
|
||||
|
@ -30,36 +30,36 @@ namespace irr
|
||||
|
||||
CD3D9RenderTarget::~CD3D9RenderTarget()
|
||||
{
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (Surface[i])
|
||||
Surface[i]->Release();
|
||||
if (Surfaces[i])
|
||||
Surfaces[i]->Release();
|
||||
}
|
||||
|
||||
if (DepthStencilSurface)
|
||||
DepthStencilSurface->Release();
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
Texture[i]->drop();
|
||||
if (Textures[i])
|
||||
Textures[i]->drop();
|
||||
}
|
||||
|
||||
if (DepthStencil)
|
||||
DepthStencil->drop();
|
||||
}
|
||||
|
||||
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
void CD3D9RenderTarget::setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces)
|
||||
{
|
||||
bool needSizeUpdate = false;
|
||||
|
||||
// Set color attachments.
|
||||
if ((Texture != texture) || (CubeSurfaces != cubeSurfaces))
|
||||
if (!Textures.equals(textures, numTextures) || !CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))
|
||||
{
|
||||
needSizeUpdate = true;
|
||||
CubeSurfaces = cubeSurfaces; // TODO: we can probably avoid some memory allocating/de-allocating if _only_ CubeSurfaces change.
|
||||
CubeSurfaces.set_data(cubeSurfaces, numCubeSurfaces); // TODO: we can probably avoid some memory allocating/de-allocating if _only_ CubeSurfaces change.
|
||||
|
||||
if (texture.size() > Driver->ActiveRenderTarget.size())
|
||||
if (numTextures > Driver->ActiveRenderTarget.size())
|
||||
{
|
||||
core::stringc message = "This GPU supports up to ";
|
||||
message += Driver->ActiveRenderTarget.size();
|
||||
@ -68,23 +68,23 @@ namespace irr
|
||||
os::Printer::log(message.c_str(), ELL_WARNING);
|
||||
}
|
||||
|
||||
const u32 size = core::min_(texture.size(), static_cast<u32>(Driver->ActiveRenderTarget.size()));
|
||||
const u32 size = core::min_(numTextures, static_cast<u32>(Driver->ActiveRenderTarget.size()));
|
||||
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (Surface[i])
|
||||
Surface[i]->Release();
|
||||
if (Surfaces[i])
|
||||
Surfaces[i]->Release();
|
||||
}
|
||||
|
||||
Surface.set_used(size);
|
||||
Surfaces.set_used(size);
|
||||
|
||||
core::array<ITexture*> prevTextures(Texture);
|
||||
core::array<ITexture*> prevTextures(Textures);
|
||||
|
||||
Texture.set_used(size);
|
||||
Textures.set_used(size);
|
||||
|
||||
for (u32 i = 0; i < size; ++i)
|
||||
{
|
||||
CD3D9Texture* currentTexture = (texture[i] && texture[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(texture[i]) : 0;
|
||||
CD3D9Texture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(textures[i]) : 0;
|
||||
|
||||
IDirect3DTexture9* textureID = 0;
|
||||
IDirect3DCubeTexture9* cubeTextureId = 0;
|
||||
@ -100,29 +100,29 @@ namespace irr
|
||||
|
||||
if (textureID)
|
||||
{
|
||||
Texture[i] = texture[i];
|
||||
Texture[i]->grab();
|
||||
Textures[i] = textures[i];
|
||||
Textures[i]->grab();
|
||||
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
textureID->GetSurfaceLevel(level, ¤tSurface);
|
||||
|
||||
Surface[i] = currentSurface;
|
||||
Surfaces[i] = currentSurface;
|
||||
}
|
||||
else if ( cubeTextureId )
|
||||
{
|
||||
Texture[i] = texture[i];
|
||||
Texture[i]->grab();
|
||||
Textures[i] = textures[i];
|
||||
Textures[i]->grab();
|
||||
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES)CubeSurfaces[i]; // we use same numbering
|
||||
cubeTextureId->GetCubeMapSurface(face, level, ¤tSurface);
|
||||
|
||||
Surface[i] = currentSurface;
|
||||
Surfaces[i] = currentSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
Surface[i] = 0;
|
||||
Texture[i] = 0;
|
||||
Surfaces[i] = 0;
|
||||
Textures[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,11 +189,11 @@ namespace irr
|
||||
|
||||
bool sizeDetected = false;
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
if (Textures[i])
|
||||
{
|
||||
Size = Texture[i]->getSize();
|
||||
Size = Textures[i]->getSize();
|
||||
sizeDetected = true;
|
||||
|
||||
break;
|
||||
@ -217,12 +217,12 @@ namespace irr
|
||||
|
||||
IDirect3DSurface9* CD3D9RenderTarget::getSurface(u32 id) const
|
||||
{
|
||||
return (id < Surface.size()) ? Surface[id] : 0;
|
||||
return (id < Surfaces.size()) ? Surfaces[id] : 0;
|
||||
}
|
||||
|
||||
u32 CD3D9RenderTarget::getSurfaceCount() const
|
||||
{
|
||||
return Surface.size();
|
||||
return Surfaces.size();
|
||||
}
|
||||
|
||||
IDirect3DSurface9* CD3D9RenderTarget::getDepthStencilSurface() const
|
||||
@ -232,12 +232,12 @@ namespace irr
|
||||
|
||||
void CD3D9RenderTarget::releaseSurfaces()
|
||||
{
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (Surface[i])
|
||||
if (Surfaces[i])
|
||||
{
|
||||
Surface[i]->Release();
|
||||
Surface[i] = 0;
|
||||
Surfaces[i]->Release();
|
||||
Surfaces[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,16 +250,16 @@ namespace irr
|
||||
|
||||
void CD3D9RenderTarget::generateSurfaces()
|
||||
{
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (!Surface[i] && Texture[i])
|
||||
if (!Surfaces[i] && Textures[i])
|
||||
{
|
||||
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Texture[i])->getDX9Texture();
|
||||
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Textures[i])->getDX9Texture();
|
||||
if ( currentTexture )
|
||||
{
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
currentTexture->GetSurfaceLevel(0, ¤tSurface);
|
||||
Surface[i] = currentSurface;
|
||||
Surfaces[i] = currentSurface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace irr
|
||||
CD3D9RenderTarget(CD3D9Driver* driver);
|
||||
virtual ~CD3D9RenderTarget();
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
|
||||
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) _IRR_OVERRIDE_;
|
||||
|
||||
const core::dimension2d<u32>& getSize() const;
|
||||
|
||||
@ -46,7 +46,7 @@ namespace irr
|
||||
protected:
|
||||
core::dimension2d<u32> Size;
|
||||
|
||||
core::array<IDirect3DSurface9*> Surface;
|
||||
core::array<IDirect3DSurface9*> Surfaces;
|
||||
|
||||
IDirect3DSurface9* DepthStencilSurface;
|
||||
|
||||
|
@ -38,17 +38,19 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
||||
|
||||
DWORD flags = 0;
|
||||
|
||||
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
|
||||
D3DDISPLAYMODE d3ddm;
|
||||
intf->GetAdapterDisplayMode(Driver->Params.DisplayAdapter, &d3ddm);
|
||||
if (HasMipMaps && HardwareMipMaps)
|
||||
{
|
||||
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
|
||||
D3DDISPLAYMODE d3ddm;
|
||||
intf->GetAdapterDisplayMode(Driver->Params.DisplayAdapter, &d3ddm);
|
||||
|
||||
if (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_AUTOGENMIPMAP, D3DRTYPE_TEXTURE, InternalFormat))
|
||||
flags = D3DUSAGE_AUTOGENMIPMAP;
|
||||
else
|
||||
HardwareMipMaps = false;
|
||||
}
|
||||
|
||||
VertexTextureSupport = Driver->getTextureCreationFlag(ETCF_SUPPORT_VERTEXT_TEXTURE)
|
||||
&& (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, InternalFormat));
|
||||
|
||||
HRESULT hr = 0;
|
||||
|
||||
|
@ -42,6 +42,11 @@ public:
|
||||
IDirect3DTexture9* getDX9Texture() const;
|
||||
IDirect3DCubeTexture9* getDX9CubeTexture() const;
|
||||
|
||||
inline bool HasVertexTextureSupport() const
|
||||
{
|
||||
return VertexTextureSupport;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class CD3D9Driver;
|
||||
|
||||
@ -77,6 +82,7 @@ private:
|
||||
u32 MipLevelLocked;
|
||||
|
||||
bool HardwareMipMaps;
|
||||
bool VertexTextureSupport;
|
||||
|
||||
IDirect3DDevice9* Device;
|
||||
IDirect3DTexture9* Texture;
|
||||
|
@ -280,7 +280,7 @@ bool CGLXManager::initialize(const SIrrlichtCreationParameters& params, const SE
|
||||
|
||||
void CGLXManager::terminate()
|
||||
{
|
||||
memset(&CurrentContext, 0, sizeof(CurrentContext));
|
||||
memset((void*)&CurrentContext, 0, sizeof(CurrentContext));
|
||||
}
|
||||
|
||||
bool CGLXManager::generateSurface()
|
||||
|
@ -642,8 +642,8 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
|
||||
|
||||
// For keys we handle the event before changing focus to give elements the chance for catching the TAB
|
||||
// Send focus changing event
|
||||
// CAREFUL when changing - there's an identical check in CGUIModalScreen::OnEvent
|
||||
if (FocusFlags & EFF_SET_ON_TAB &&
|
||||
event.EventType == EET_KEY_INPUT_EVENT &&
|
||||
event.KeyInput.PressedDown &&
|
||||
event.KeyInput.Key == KEY_TAB)
|
||||
{
|
||||
@ -1073,11 +1073,12 @@ IGUIWindow* CGUIEnvironment::addWindow(const core::rect<s32>& rectangle, bool mo
|
||||
|
||||
|
||||
//! adds a modal screen. The returned pointer must not be dropped.
|
||||
IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)
|
||||
IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent, int blinkMode)
|
||||
{
|
||||
parent = parent ? parent : this;
|
||||
|
||||
IGUIElement *win = new CGUIModalScreen(this, parent, -1);
|
||||
CGUIModalScreen *win = new CGUIModalScreen(this, parent, -1);
|
||||
win->setBlinkMode(blinkMode);
|
||||
win->drop();
|
||||
|
||||
return win;
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) _IRR_OVERRIDE_;
|
||||
|
||||
//! adds a modal screen. The returned pointer must not be dropped.
|
||||
virtual IGUIElement* addModalScreen(IGUIElement* parent) _IRR_OVERRIDE_;
|
||||
virtual IGUIElement* addModalScreen(IGUIElement* parent, int blinkMode) _IRR_OVERRIDE_;
|
||||
|
||||
//! Adds a message box.
|
||||
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
|
||||
|
@ -720,6 +720,7 @@ void CGUIListBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWr
|
||||
}
|
||||
}
|
||||
}
|
||||
out->addInt("Selected", Selected);
|
||||
}
|
||||
|
||||
|
||||
@ -759,6 +760,8 @@ void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
|
||||
}
|
||||
}
|
||||
}
|
||||
Selected = in->getAttributeAsInt("Selected", Selected);
|
||||
recalculateScrollPos();
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@ namespace gui
|
||||
//! constructor
|
||||
CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* parent, s32 id)
|
||||
: IGUIElement(EGUIET_MODAL_SCREEN, environment, parent, id, core::recti(0, 0, parent->getAbsolutePosition().getWidth(), parent->getAbsolutePosition().getHeight()) ),
|
||||
BlinkMode(3),
|
||||
MouseDownTime(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@ -90,7 +91,8 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
|
||||
{
|
||||
Environment->removeFocus(0); // can't setFocus otherwise at it still has focus here
|
||||
Environment->setFocus(event.GUIEvent.Element);
|
||||
MouseDownTime = os::Timer::getTime();
|
||||
if ( BlinkMode&1 )
|
||||
MouseDownTime = os::Timer::getTime();
|
||||
return true;
|
||||
}
|
||||
if ( !canTakeFocus(event.GUIEvent.Caller))
|
||||
@ -112,7 +114,7 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
|
||||
else
|
||||
Environment->setFocus(this);
|
||||
}
|
||||
else
|
||||
else if ( BlinkMode&1 )
|
||||
{
|
||||
MouseDownTime = os::Timer::getTime();
|
||||
}
|
||||
@ -130,10 +132,24 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
|
||||
}
|
||||
break;
|
||||
case EET_MOUSE_INPUT_EVENT:
|
||||
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
||||
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN && (BlinkMode & 2))
|
||||
{
|
||||
MouseDownTime = os::Timer::getTime();
|
||||
}
|
||||
break;
|
||||
case EET_KEY_INPUT_EVENT:
|
||||
// CAREFUL when changing - there's an identical check in CGUIEnvironment::postEventFromUser
|
||||
if (Environment->getFocusBehavior() & EFF_SET_ON_TAB &&
|
||||
event.KeyInput.PressedDown &&
|
||||
event.KeyInput.Key == KEY_TAB)
|
||||
{
|
||||
IGUIElement* next = Environment->getNextElement(event.KeyInput.Shift, event.KeyInput.Control);
|
||||
if ( next && isMyChild(next) )
|
||||
{
|
||||
// Pass on the TAB-key, otherwise focus-tabbing inside modal screens breaks
|
||||
return false;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -153,7 +169,7 @@ void CGUIModalScreen::draw()
|
||||
return;
|
||||
|
||||
u32 now = os::Timer::getTime();
|
||||
if (now - MouseDownTime < 300 && (now / 70)%2)
|
||||
if (BlinkMode && now - MouseDownTime < 300 && (now / 70)%2)
|
||||
{
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
core::rect<s32> r;
|
||||
@ -219,12 +235,16 @@ void CGUIModalScreen::updateAbsolutePosition()
|
||||
void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
|
||||
{
|
||||
IGUIElement::serializeAttributes(out,options);
|
||||
|
||||
out->addInt("BlinkMode", BlinkMode );
|
||||
}
|
||||
|
||||
//! Reads attributes of the element
|
||||
void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
|
||||
{
|
||||
IGUIElement::deserializeAttributes(in, options);
|
||||
|
||||
BlinkMode = in->getAttributeAsInt("BlinkMode", BlinkMode);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,11 +52,27 @@ namespace gui
|
||||
//! Reads attributes of the element
|
||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
|
||||
|
||||
//! Set when to blink.
|
||||
//! Bitset of following values (can be combined)
|
||||
//! 0 = never
|
||||
//! 1 = focus changes
|
||||
//! 2 = Left mouse button pressed down
|
||||
void setBlinkMode(u32 blink)
|
||||
{
|
||||
BlinkMode = blink;
|
||||
}
|
||||
|
||||
u32 getBlinkMode() const
|
||||
{
|
||||
return BlinkMode;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool canTakeFocus(IGUIElement* target) const;
|
||||
|
||||
private:
|
||||
|
||||
u32 BlinkMode;
|
||||
u32 MouseDownTime;
|
||||
};
|
||||
|
||||
|
@ -378,7 +378,7 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
|
||||
blockSize.Height = hMapSize.Height - processed.Y;
|
||||
|
||||
SMeshBuffer* buffer = new SMeshBuffer();
|
||||
buffer->setHardwareMappingHint(scene::EHM_STATIC);
|
||||
buffer->setHardwareMappingHint(EHM_STATIC);
|
||||
buffer->Vertices.reallocate(blockSize.getArea());
|
||||
// add vertices of vertex block
|
||||
u32 y;
|
||||
@ -500,7 +500,7 @@ IMesh* CGeometryCreator::createArrowMesh(const u32 tesselationCylinder,
|
||||
IMesh* mesh2 = createConeMesh(width1, height-cylinderHeight, tesselationCone, vtxColor1, vtxColor0);
|
||||
for (u32 i=0; i<mesh2->getMeshBufferCount(); ++i)
|
||||
{
|
||||
scene::IMeshBuffer* buffer = mesh2->getMeshBuffer(i);
|
||||
IMeshBuffer* buffer = mesh2->getMeshBuffer(i);
|
||||
for (u32 j=0; j<buffer->getVertexCount(); ++j)
|
||||
buffer->getPosition(j).Y += cylinderHeight;
|
||||
buffer->setDirty(EBT_VERTEX);
|
||||
@ -925,6 +925,138 @@ IMesh* CGeometryCreator::createConeMesh(f32 radius, f32 length, u32 tesselation,
|
||||
return mesh;
|
||||
}
|
||||
|
||||
irr::scene::IMesh* CGeometryCreator::createTorusMesh(irr::f32 majorRadius, irr::f32 minorRadius, irr::u32 majorSegments, irr::u32 minorSegments, f32 angleStart, f32 angleEnd, int capEnds) const
|
||||
{
|
||||
if ( majorRadius == 0.f || minorRadius == 0.f )
|
||||
return 0;
|
||||
|
||||
if ( majorSegments < 3 )
|
||||
majorSegments = 3;
|
||||
if ( minorSegments < 3 )
|
||||
minorSegments = 3;
|
||||
|
||||
// Note: first/last vertices of major and minor lines are on same position, but not shared to allow for independent uv's.
|
||||
|
||||
// prevent 16-bit vertex buffer overflow
|
||||
const u32 numCapVertices = (capEnds & 1 ? 1 : 0) + (capEnds & 2 ? 1 : 0);
|
||||
u32 numVertices = (majorSegments+1)*(minorSegments+1)+numCapVertices;
|
||||
while (numVertices > 65536)
|
||||
{
|
||||
if ( majorSegments > 2*minorSegments )
|
||||
majorSegments /= 2;
|
||||
else if ( minorSegments > 2*majorSegments )
|
||||
minorSegments /= 2;
|
||||
else
|
||||
{
|
||||
majorSegments /= 2;
|
||||
minorSegments /= 2;
|
||||
}
|
||||
numVertices = (majorSegments+1)*(minorSegments+1)+numCapVertices;
|
||||
}
|
||||
|
||||
const u32 majorLines = majorSegments+1;
|
||||
const u32 minorLines = minorSegments+1;
|
||||
|
||||
const video::SColor color(255,255,255,255);
|
||||
SMeshBuffer* buffer = new SMeshBuffer();
|
||||
buffer->Indices.reallocate(majorSegments*minorSegments*6);
|
||||
buffer->Vertices.reallocate(numVertices);
|
||||
|
||||
if ( angleStart > angleEnd )
|
||||
core::swap(angleStart, angleEnd);
|
||||
const f32 radStart = angleStart * core::DEGTORAD;
|
||||
const f32 radEnd = angleEnd * core::DEGTORAD;
|
||||
const f32 radMajor = radEnd-radStart;
|
||||
const f32 radStepMajor = radMajor / majorSegments;
|
||||
const f32 TWO_PI = 2.f*core::PI;
|
||||
const f32 radStepMinor = TWO_PI / minorSegments;
|
||||
|
||||
// vertices
|
||||
for ( irr::u32 major = 0; major < majorLines; ++major)
|
||||
{
|
||||
const f32 radMajor = radStart + major*radStepMajor;
|
||||
const f32 cosMajor = cosf(radMajor);
|
||||
const f32 sinMajor = sinf(radMajor);
|
||||
|
||||
// points of major circle
|
||||
const core::vector3df pm(majorRadius*cosMajor, 0.f, majorRadius * sinMajor);
|
||||
|
||||
for ( irr::u32 minor = 0; minor < minorLines; ++minor)
|
||||
{
|
||||
const f32 radMinor = minor*radStepMinor;
|
||||
const f32 cosMinor = cosf(radMinor);
|
||||
|
||||
const core::vector3df n(cosMinor * cosMajor, sinf(radMinor), cosMinor * sinMajor);
|
||||
const core::vector2df uv(radMajor/TWO_PI, radMinor/TWO_PI);
|
||||
buffer->Vertices.push_back( video::S3DVertex(pm+n*minorRadius, n, color, uv) );
|
||||
}
|
||||
}
|
||||
|
||||
// indices
|
||||
for ( irr::u32 major = 0; major < majorSegments; ++major)
|
||||
{
|
||||
for ( irr::u32 minor = 0; minor < minorSegments; ++minor)
|
||||
{
|
||||
const irr::u16 i = major*minorLines+minor;
|
||||
buffer->Indices.push_back(i+1);
|
||||
buffer->Indices.push_back(i+minorLines);
|
||||
buffer->Indices.push_back(i);
|
||||
|
||||
buffer->Indices.push_back(i+1);
|
||||
buffer->Indices.push_back(i+minorLines+1);
|
||||
buffer->Indices.push_back(i+minorLines);
|
||||
}
|
||||
}
|
||||
|
||||
// add start caps
|
||||
if ( capEnds & 1 )
|
||||
{
|
||||
const core::vector3df p(cosf(radStart), 0.f, sinf(radStart));
|
||||
const core::vector3df n( p.crossProduct(core::vector3df(0,-1,0)) );
|
||||
const core::vector2df uv(radStart/TWO_PI, 0.5f);
|
||||
buffer->Vertices.push_back( video::S3DVertex(p*majorRadius, n, color, uv) );
|
||||
|
||||
const irr::u16 i=buffer->Vertices.size()-1;
|
||||
for ( irr::u32 minor = 0; minor < minorSegments; ++minor)
|
||||
{
|
||||
buffer->Indices.push_back(minor+1);
|
||||
buffer->Indices.push_back(minor);
|
||||
buffer->Indices.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
// add end caps
|
||||
if ( capEnds & 2 )
|
||||
{
|
||||
const core::vector3df p(cosf(radEnd), 0.f, sinf(radEnd));
|
||||
const core::vector3df n( p.crossProduct(core::vector3df(0,1,0)) );
|
||||
const core::vector2df uv(radEnd/TWO_PI, 0.5f);
|
||||
buffer->Vertices.push_back( video::S3DVertex(p*majorRadius, n, color, uv) );
|
||||
|
||||
const irr::u16 i=buffer->Vertices.size()-1;
|
||||
const irr::u16 k=i-numCapVertices;
|
||||
for ( irr::u32 minor = 0; minor < minorSegments; ++minor)
|
||||
{
|
||||
buffer->Indices.push_back(k-minor-1);
|
||||
buffer->Indices.push_back(k-minor);
|
||||
buffer->Indices.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
// recalculate bounding box
|
||||
buffer->BoundingBox.MaxEdge.X = core::abs_(majorRadius)+core::abs_(minorRadius);
|
||||
buffer->BoundingBox.MaxEdge.Z = buffer->BoundingBox.MaxEdge.X;
|
||||
buffer->BoundingBox.MaxEdge.Y = core::abs_(minorRadius);
|
||||
buffer->BoundingBox.MinEdge = buffer->BoundingBox.MaxEdge*-1.f;
|
||||
|
||||
SMesh* mesh = new SMesh();
|
||||
mesh->addMeshBuffer(buffer);
|
||||
buffer->drop();
|
||||
|
||||
mesh->setHardwareMappingHint(EHM_STATIC);
|
||||
mesh->recalculateBoundingBox();
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void CGeometryCreator::addToBuffer(const video::S3DVertex& v, SMeshBuffer* Buffer) const
|
||||
{
|
||||
|
@ -51,6 +51,10 @@ public:
|
||||
const video::SColor& colorBottom=0xffffffff,
|
||||
f32 oblique=0.f) const _IRR_OVERRIDE_;
|
||||
|
||||
virtual IMesh* createTorusMesh(f32 majorRadius, f32 minorRadius,
|
||||
u32 majorSegments, u32 minorSegments,
|
||||
f32 angleStart, f32 angleEnd, int capEnds) const _IRR_OVERRIDE_;
|
||||
|
||||
virtual IMesh* createVolumeLightMesh(
|
||||
const u32 subdivideU=32, const u32 subdivideV=32,
|
||||
const video::SColor footColor=0xffffffff,
|
||||
|
@ -16,11 +16,6 @@ namespace irr
|
||||
namespace video
|
||||
{
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_LIBJPEG_
|
||||
// Static members
|
||||
io::path CImageLoaderJPG::Filename;
|
||||
#endif
|
||||
|
||||
//! constructor
|
||||
CImageLoaderJPG::CImageLoaderJPG()
|
||||
{
|
||||
@ -56,6 +51,9 @@ bool CImageLoaderJPG::isALoadableFileExtension(const io::path& filename) const
|
||||
|
||||
// for longjmp, to return to caller on a fatal error
|
||||
jmp_buf setjmp_buffer;
|
||||
|
||||
// for having access to the filename when printing the error messages
|
||||
core::stringc* filename;
|
||||
};
|
||||
|
||||
void CImageLoaderJPG::init_source (j_decompress_ptr cinfo)
|
||||
@ -113,7 +111,9 @@ void CImageLoaderJPG::output_message(j_common_ptr cinfo)
|
||||
c8 temp1[JMSG_LENGTH_MAX];
|
||||
(*cinfo->err->format_message)(cinfo, temp1);
|
||||
core::stringc errMsg("JPEG FATAL ERROR in ");
|
||||
errMsg += core::stringc(Filename);
|
||||
|
||||
irr_jpeg_error_mgr* myerr = (irr_jpeg_error_mgr*)cinfo->err;
|
||||
errMsg += *myerr->filename;
|
||||
os::Printer::log(errMsg.c_str(),temp1, ELL_ERROR);
|
||||
}
|
||||
#endif // _IRR_COMPILE_WITH_LIBJPEG_
|
||||
@ -144,7 +144,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
Filename = file->getFileName();
|
||||
core::stringc filename = file->getFileName();
|
||||
|
||||
u8 **rowPtr=0;
|
||||
u8* input = new u8[file->getSize()];
|
||||
@ -162,6 +162,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||
cinfo.err->error_exit = error_exit;
|
||||
cinfo.err->output_message = output_message;
|
||||
jerr.filename = &filename;
|
||||
|
||||
// compatibility fudge:
|
||||
// we need to use setjmp/longjmp for error handling as gcc-linux
|
||||
|
@ -100,9 +100,6 @@ private:
|
||||
data has been read. Often a no-op. */
|
||||
static void term_source (j_decompress_ptr cinfo);
|
||||
|
||||
// Copy filename to have it around for error-messages
|
||||
static io::path Filename;
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_LIBJPEG_
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace irr
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
|
||||
{
|
||||
return EIDT_CONSOLE;
|
||||
return EIDT_CONSOLE;
|
||||
}
|
||||
|
||||
void addPostPresentText(s16 X, s16 Y, const wchar_t *text);
|
||||
|
@ -146,7 +146,8 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
||||
// create the window, only if we do not use the null device
|
||||
if (!createWindow())
|
||||
return;
|
||||
setResizable(param.WindowResizable);
|
||||
if (param.WindowResizable < 2 )
|
||||
setResizable(param.WindowResizable == 1 ? true : false);
|
||||
}
|
||||
|
||||
// create cursor control
|
||||
@ -521,12 +522,25 @@ bool CIrrDeviceLinux::createWindow()
|
||||
XWindow = (Window)CreationParams.WindowId;
|
||||
if (!CreationParams.IgnoreInput)
|
||||
{
|
||||
XCreateWindow(XDisplay,
|
||||
// Note: This might be further improved by using a InputOnly window instead of InputOutput.
|
||||
// I think then it should be possible to render into the given parent window instead of
|
||||
// creating a child-window.
|
||||
// That could also be a third option for IgnoreInput in the CreationParams.
|
||||
// But we need another window variable then and have to split input/output in
|
||||
// the rest of the device code.
|
||||
// Also... this does possibly leak.
|
||||
Window child_window = XCreateWindow(XDisplay,
|
||||
XWindow,
|
||||
0, 0, Width, Height, 0, VisualInfo->depth,
|
||||
InputOutput, VisualInfo->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask,
|
||||
&WndAttributes);
|
||||
|
||||
// do not forget to map new window
|
||||
XMapWindow(XDisplay, child_window);
|
||||
|
||||
// overwrite device window id
|
||||
XWindow = child_window;
|
||||
}
|
||||
XWindowAttributes wa;
|
||||
XGetWindowAttributes(XDisplay, XWindow, &wa);
|
||||
@ -2201,6 +2215,9 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
|
||||
: Device(dev)
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
, PlatformBehavior(gui::ECPB_NONE), LastQuery(0)
|
||||
#ifdef _IRR_LINUX_X11_XINPUT2_
|
||||
, DeviceId(0)
|
||||
#endif
|
||||
#endif
|
||||
, IsVisible(true), Null(null), UseReferenceRect(false)
|
||||
, ActiveIcon(gui::ECI_NORMAL), ActiveIconStartTime(0)
|
||||
@ -2208,6 +2225,10 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
if (!Null)
|
||||
{
|
||||
#ifdef _IRR_LINUX_X11_XINPUT2_
|
||||
XIGetClientPointer(Device->XDisplay, Device->XWindow, &DeviceId);
|
||||
#endif
|
||||
|
||||
XGCValues values;
|
||||
unsigned long valuemask = 0;
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
#endif
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#ifdef _IRR_LINUX_X11_XINPUT2_
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define KeySym s32
|
||||
#endif
|
||||
@ -121,7 +125,7 @@ namespace irr
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
|
||||
{
|
||||
return EIDT_X11;
|
||||
return EIDT_X11;
|
||||
}
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
@ -215,22 +219,54 @@ namespace irr
|
||||
{
|
||||
if (UseReferenceRect)
|
||||
{
|
||||
XWarpPointer(Device->XDisplay,
|
||||
None,
|
||||
Device->XWindow, 0, 0,
|
||||
Device->Width,
|
||||
Device->Height,
|
||||
ReferenceRect.UpperLeftCorner.X + x,
|
||||
ReferenceRect.UpperLeftCorner.Y + y);
|
||||
|
||||
// NOTE: XIWarpPointer works when X11 has set a coordinate transformation matrix for the mouse unlike XWarpPointer
|
||||
// which runs into a bug mentioned here: https://gitlab.freedesktop.org/xorg/xserver/-/issues/600
|
||||
// So also workaround for Irrlicht bug #450
|
||||
#ifdef _IRR_LINUX_X11_XINPUT2_
|
||||
if ( DeviceId != 0)
|
||||
{
|
||||
XIWarpPointer(Device->XDisplay,
|
||||
DeviceId,
|
||||
None,
|
||||
Device->XWindow, 0, 0,
|
||||
Device->Width,
|
||||
Device->Height,
|
||||
ReferenceRect.UpperLeftCorner.X + x,
|
||||
ReferenceRect.UpperLeftCorner.Y + y);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XWarpPointer(Device->XDisplay,
|
||||
None,
|
||||
Device->XWindow, 0, 0,
|
||||
Device->Width,
|
||||
Device->Height,
|
||||
ReferenceRect.UpperLeftCorner.X + x,
|
||||
ReferenceRect.UpperLeftCorner.Y + y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XWarpPointer(Device->XDisplay,
|
||||
None,
|
||||
Device->XWindow, 0, 0,
|
||||
Device->Width,
|
||||
Device->Height, x, y);
|
||||
#ifdef _IRR_LINUX_X11_XINPUT2_
|
||||
if ( DeviceId != 0)
|
||||
{
|
||||
XIWarpPointer(Device->XDisplay,
|
||||
DeviceId,
|
||||
None,
|
||||
Device->XWindow, 0, 0,
|
||||
Device->Width,
|
||||
Device->Height, x, y);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XWarpPointer(Device->XDisplay,
|
||||
None,
|
||||
Device->XWindow, 0, 0,
|
||||
Device->Width,
|
||||
Device->Height, x, y);
|
||||
}
|
||||
}
|
||||
XFlush(Device->XDisplay);
|
||||
}
|
||||
@ -344,6 +380,10 @@ namespace irr
|
||||
u32 LastQuery;
|
||||
Cursor InvisCursor;
|
||||
|
||||
#ifdef _IRR_LINUX_X11_XINPUT2_
|
||||
int DeviceId;
|
||||
#endif
|
||||
|
||||
struct CursorFrameX11
|
||||
{
|
||||
CursorFrameX11() : IconHW(0) {}
|
||||
|
@ -187,7 +187,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
||||
Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_ANYFORMAT),
|
||||
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),
|
||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||
Resizable(param.WindowResizable), WindowMinimized(false)
|
||||
Resizable(param.WindowResizable == 1 ? true : false), WindowMinimized(false)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceSDL");
|
||||
|
@ -100,7 +100,7 @@ namespace irr
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
|
||||
{
|
||||
return EIDT_SDL;
|
||||
return EIDT_SDL;
|
||||
}
|
||||
|
||||
//! Implementation of the linux cursor control
|
||||
|
@ -1050,7 +1050,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
||||
clientSize.right = CreationParams.WindowSize.Width;
|
||||
clientSize.bottom = CreationParams.WindowSize.Height;
|
||||
|
||||
DWORD style = getWindowStyle(CreationParams.Fullscreen, CreationParams.WindowResizable);
|
||||
DWORD style = getWindowStyle(CreationParams.Fullscreen, CreationParams.WindowResizable > 0 ? true : false);
|
||||
AdjustWindowRect(&clientSize, style, FALSE);
|
||||
|
||||
const s32 realWidth = clientSize.right - clientSize.left;
|
||||
@ -1708,7 +1708,7 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
||||
(LPBYTE) szProductType, &dwBufLen);
|
||||
RegCloseKey( hKey );
|
||||
|
||||
|
||||
|
||||
if (irr::core::stringc("WINNT").equals_ignore_case(szProductType))
|
||||
out.append("Professional ");
|
||||
if (irr::core::stringc("LANMANNT").equals_ignore_case(szProductType))
|
||||
|
@ -107,7 +107,7 @@ namespace irr
|
||||
//! Get the device type
|
||||
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
|
||||
{
|
||||
return EIDT_WIN32;
|
||||
return EIDT_WIN32;
|
||||
}
|
||||
|
||||
//! Compares to the last call of this function to return double and triple clicks.
|
||||
|
@ -31,22 +31,22 @@ namespace video
|
||||
~CNSOGLManager();
|
||||
|
||||
// Initialize
|
||||
bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data);
|
||||
bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) _IRR_OVERRIDE_;
|
||||
|
||||
// Terminate
|
||||
void terminate();
|
||||
void terminate() _IRR_OVERRIDE_;
|
||||
|
||||
// Create surface.
|
||||
bool generateSurface();
|
||||
bool generateSurface() _IRR_OVERRIDE_;
|
||||
|
||||
// Destroy surface.
|
||||
void destroySurface();
|
||||
void destroySurface() _IRR_OVERRIDE_;
|
||||
|
||||
// Create context.
|
||||
bool generateContext();
|
||||
bool generateContext() _IRR_OVERRIDE_;
|
||||
|
||||
// Destroy EGL context.
|
||||
void destroyContext();
|
||||
void destroyContext() _IRR_OVERRIDE_;
|
||||
|
||||
//! Get current context
|
||||
const SExposedVideoData& getContext() const;
|
||||
@ -55,7 +55,7 @@ namespace video
|
||||
bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero) _IRR_OVERRIDE_;
|
||||
|
||||
// Swap buffers.
|
||||
bool swapBuffers();
|
||||
bool swapBuffers() _IRR_OVERRIDE_;
|
||||
|
||||
private:
|
||||
SIrrlichtCreationParameters Params;
|
||||
|
@ -190,7 +190,7 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
|
||||
|
||||
|
||||
// set ExposedData to 0
|
||||
memset(&ExposedData, 0, sizeof(ExposedData));
|
||||
memset((void*)&ExposedData, 0, sizeof(ExposedData));
|
||||
for (u32 i=0; i<video::EVDF_COUNT; ++i)
|
||||
FeatureEnabled[i]=true;
|
||||
|
||||
@ -867,8 +867,8 @@ void CNullDriver::draw2DImage(const video::ITexture* texture, const core::positi
|
||||
|
||||
draw2DImage(texture,destPos, core::rect<s32>(core::position2d<s32>(0,0),
|
||||
core::dimension2di(texture->getOriginalSize())),
|
||||
0,
|
||||
SColor(255,255,255,255),
|
||||
0,
|
||||
SColor(255,255,255,255),
|
||||
useAlphaChannelOfTexture
|
||||
);
|
||||
}
|
||||
@ -1603,7 +1603,9 @@ core::array<IImage*> CNullDriver::createImagesFromFile(io::IReadFile* file, E_TE
|
||||
{
|
||||
// dito
|
||||
file->seek(0);
|
||||
if (SurfaceLoader[i]->isALoadableFileFormat(file))
|
||||
if (SurfaceLoader[i]->isALoadableFileFormat(file)
|
||||
&& !SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()) // extension was tried above already
|
||||
)
|
||||
{
|
||||
file->seek(0);
|
||||
imageArray = SurfaceLoader[i]->loadImages(file, type);
|
||||
@ -2763,9 +2765,9 @@ bool CNullDriver::needsTransparentRenderPass(const irr::video::SMaterial& materi
|
||||
// zwrite disabled and getWriteZBuffer calls this function.
|
||||
|
||||
video::IMaterialRenderer* rnd = getMaterialRenderer(material.MaterialType);
|
||||
// TODO: I suspect IMaterialRenderer::isTransparent also often could use SMaterial as parameter
|
||||
// TODO: I suspect IMaterialRenderer::isTransparent also often could use SMaterial as parameter
|
||||
// We could for example then get rid of IsTransparent function in SMaterial and move that to the software material renderer.
|
||||
if (rnd && rnd->isTransparent())
|
||||
if (rnd && rnd->isTransparent())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -711,11 +711,11 @@ const c8* COBJMeshFileLoader::readColor(const c8* bufPtr, video::SColor& color,
|
||||
c8 colStr[COLOR_BUFFER_LENGTH];
|
||||
|
||||
bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd);
|
||||
color.setRed((s32)(core::fast_atof(colStr) * 255.0f));
|
||||
color.setRed((u32)core::round32(core::fast_atof(colStr)*255.f));
|
||||
bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd);
|
||||
color.setGreen((s32)(core::fast_atof(colStr) * 255.0f));
|
||||
color.setGreen((u32)core::round32(core::fast_atof(colStr)*255.f));
|
||||
bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd);
|
||||
color.setBlue((s32)(core::fast_atof(colStr) * 255.0f));
|
||||
color.setBlue((u32)core::round32(core::fast_atof(colStr)*255.f));
|
||||
return bufPtr;
|
||||
}
|
||||
|
||||
|
@ -244,34 +244,25 @@ bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
|
||||
|
||||
void COBJMeshWriter::getVectorAsStringLine(const core::vector3df& v, core::stringc& s) const
|
||||
{
|
||||
s = core::stringc(-v.X);
|
||||
s += " ";
|
||||
s += core::stringc(v.Y);
|
||||
s += " ";
|
||||
s += core::stringc(v.Z);
|
||||
s += "\n";
|
||||
c8 tmpbuf[255];
|
||||
snprintf_irr(tmpbuf, 255, "%f %f %f\n", -v.X, v.Y, v.Z);
|
||||
s = tmpbuf;
|
||||
}
|
||||
|
||||
|
||||
void COBJMeshWriter::getVectorAsStringLine(const core::vector2df& v, core::stringc& s) const
|
||||
{
|
||||
s = core::stringc(v.X);
|
||||
s += " ";
|
||||
s += core::stringc(1-v.Y);
|
||||
s += "\n";
|
||||
c8 tmpbuf[255];
|
||||
snprintf_irr(tmpbuf, 255, "%f %f\n", v.X, 1.f-v.Y);
|
||||
s = tmpbuf;
|
||||
}
|
||||
|
||||
|
||||
void COBJMeshWriter::getColorAsStringLine(const video::SColor& color, const c8* const prefix, core::stringc& s) const
|
||||
{
|
||||
s = prefix;
|
||||
s += " ";
|
||||
s += core::stringc((double)(color.getRed()/255.f));
|
||||
s += " ";
|
||||
s += core::stringc((double)(color.getGreen()/255.f));
|
||||
s += " ";
|
||||
s += core::stringc((double)(color.getBlue()/255.f));
|
||||
s += "\n";
|
||||
c8 tmpbuf[255];
|
||||
snprintf_irr(tmpbuf, 255, "%s %f %f %f\n", prefix, (float)(color.getRed()/255.f), (float)(color.getGreen()/255.f), (float)(color.getBlue()/255.f));
|
||||
s = tmpbuf;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,10 +37,10 @@ public:
|
||||
if (ColorAttachment > 0)
|
||||
Driver->irrGlGenFramebuffers(1, &BufferID);
|
||||
|
||||
AssignedTexture.set_used(static_cast<u32>(ColorAttachment));
|
||||
AssignedTextures.set_used(static_cast<u32>(ColorAttachment));
|
||||
|
||||
for (u32 i = 0; i < AssignedTexture.size(); ++i)
|
||||
AssignedTexture[i] = GL_NONE;
|
||||
for (u32 i = 0; i < AssignedTextures.size(); ++i)
|
||||
AssignedTextures[i] = GL_NONE;
|
||||
}
|
||||
|
||||
virtual ~COpenGLCoreRenderTarget()
|
||||
@ -48,28 +48,28 @@ public:
|
||||
if (ColorAttachment > 0 && BufferID != 0)
|
||||
Driver->irrGlDeleteFramebuffers(1, &BufferID);
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
Texture[i]->drop();
|
||||
if (Textures[i])
|
||||
Textures[i]->drop();
|
||||
}
|
||||
|
||||
if (DepthStencil)
|
||||
DepthStencil->drop();
|
||||
}
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& textures, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_
|
||||
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) _IRR_OVERRIDE_
|
||||
{
|
||||
bool needSizeUpdate = false;
|
||||
|
||||
// Set color attachments.
|
||||
if ((Texture != textures) || (CubeSurfaces != cubeSurfaces))
|
||||
if (!Textures.equals(textures, numTextures) || !CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))
|
||||
{
|
||||
needSizeUpdate = true;
|
||||
|
||||
core::array<ITexture*> prevTextures(Texture);
|
||||
core::array<ITexture*> prevTextures(Textures);
|
||||
|
||||
if (textures.size() > static_cast<u32>(ColorAttachment))
|
||||
if (numTextures > static_cast<u32>(ColorAttachment))
|
||||
{
|
||||
core::stringc message = "This GPU supports up to ";
|
||||
message += static_cast<u32>(ColorAttachment);
|
||||
@ -78,9 +78,9 @@ public:
|
||||
os::Printer::log(message.c_str(), ELL_WARNING);
|
||||
}
|
||||
|
||||
Texture.set_used(core::min_(textures.size(), static_cast<u32>(ColorAttachment)));
|
||||
Textures.set_used(core::min_(numTextures, static_cast<u32>(ColorAttachment)));
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
TOpenGLTexture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(textures[i]) : 0;
|
||||
|
||||
@ -93,12 +93,12 @@ public:
|
||||
|
||||
if (textureID != 0)
|
||||
{
|
||||
Texture[i] = textures[i];
|
||||
Texture[i]->grab();
|
||||
Textures[i] = textures[i];
|
||||
Textures[i]->grab();
|
||||
}
|
||||
else
|
||||
{
|
||||
Texture[i] = 0;
|
||||
Textures[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,9 +111,9 @@ public:
|
||||
RequestTextureUpdate = true;
|
||||
}
|
||||
|
||||
if (CubeSurfaces != cubeSurfaces)
|
||||
if (!CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))
|
||||
{
|
||||
CubeSurfaces = cubeSurfaces;
|
||||
CubeSurfaces.set_data(cubeSurfaces, numCubeSurfaces);
|
||||
RequestTextureUpdate = true;
|
||||
}
|
||||
|
||||
@ -183,26 +183,26 @@ public:
|
||||
{
|
||||
// Set new color textures.
|
||||
|
||||
const u32 textureSize = core::min_(Texture.size(), AssignedTexture.size());
|
||||
const u32 textureSize = core::min_(Textures.size(), AssignedTextures.size());
|
||||
|
||||
for (u32 i = 0; i < textureSize; ++i)
|
||||
{
|
||||
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Texture[i]);
|
||||
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Textures[i]);
|
||||
GLuint textureID = currentTexture ? currentTexture->getOpenGLTextureName() : 0;
|
||||
|
||||
if (textureID != 0)
|
||||
{
|
||||
AssignedTexture[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||
AssignedTextures[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||
GLenum textarget = currentTexture->getType() == ETT_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_POSITIVE_X + (int)CubeSurfaces[i];
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], textarget, textureID, 0);
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], textarget, textureID, 0);
|
||||
#ifdef _DEBUG
|
||||
Driver->testGLError(__LINE__);
|
||||
#endif
|
||||
}
|
||||
else if (AssignedTexture[i] != GL_NONE)
|
||||
else if (AssignedTextures[i] != GL_NONE)
|
||||
{
|
||||
AssignedTexture[i] = GL_NONE;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);
|
||||
AssignedTextures[i] = GL_NONE;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
|
||||
|
||||
os::Printer::log("Error: Could not set render target.", ELL_ERROR);
|
||||
}
|
||||
@ -210,12 +210,12 @@ public:
|
||||
|
||||
// Reset other render target channels.
|
||||
|
||||
for (u32 i = textureSize; i < AssignedTexture.size(); ++i)
|
||||
for (u32 i = textureSize; i < AssignedTextures.size(); ++i)
|
||||
{
|
||||
if (AssignedTexture[i] != GL_NONE)
|
||||
if (AssignedTextures[i] != GL_NONE)
|
||||
{
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);
|
||||
AssignedTexture[i] = GL_NONE;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
|
||||
AssignedTextures[i] = GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ public:
|
||||
|
||||
if (ColorAttachment > 0 && BufferID != 0)
|
||||
{
|
||||
const u32 textureSize = Texture.size();
|
||||
const u32 textureSize = Textures.size();
|
||||
|
||||
if (textureSize == 0)
|
||||
Driver->irrGlDrawBuffer(GL_NONE);
|
||||
@ -293,9 +293,9 @@ public:
|
||||
Driver->irrGlDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
else
|
||||
{
|
||||
const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTexture.size()));
|
||||
const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTextures.size()));
|
||||
|
||||
Driver->irrGlDrawBuffers(bufferCount, AssignedTexture.pointer());
|
||||
Driver->irrGlDrawBuffers(bufferCount, AssignedTextures.pointer());
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
@ -322,10 +322,10 @@ public:
|
||||
|
||||
ITexture* getTexture() const
|
||||
{
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
return Texture[i];
|
||||
if (Textures[i])
|
||||
return Textures[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -372,7 +372,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
core::array<GLenum> AssignedTexture;
|
||||
core::array<GLenum> AssignedTextures;
|
||||
bool AssignedDepth;
|
||||
bool AssignedStencil;
|
||||
|
||||
|
@ -22,7 +22,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
||||
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0), MaxIndices(65535),
|
||||
MaxTextureSize(1), MaxGeometryVerticesOut(0),
|
||||
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
|
||||
OcclusionQuerySupport(false)
|
||||
OcclusionQuerySupport(false), IsAtiRadeonX(false)
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
,pGlActiveTexture(0)
|
||||
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
|
||||
@ -387,6 +387,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
||||
TextureCompressionExtension = FeatureAvailable[IRR_ARB_texture_compression];
|
||||
StencilBuffer=stencilBuffer;
|
||||
|
||||
const char* renderer = (const char*)glGetString(GL_RENDERER);
|
||||
if ( renderer )
|
||||
{
|
||||
IsAtiRadeonX = (strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0);
|
||||
}
|
||||
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define IRR_OGL_LOAD_EXTENSION(x) wglGetProcAddress(reinterpret_cast<const char*>(x))
|
||||
@ -827,7 +833,7 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
||||
case EVDF_MIP_MAP:
|
||||
return true;
|
||||
case EVDF_MIP_MAP_AUTO_UPDATE:
|
||||
return FeatureAvailable[IRR_SGIS_generate_mipmap] || FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object];
|
||||
return !IsAtiRadeonX && (FeatureAvailable[IRR_SGIS_generate_mipmap] || FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object]);
|
||||
case EVDF_STENCIL_BUFFER:
|
||||
return StencilBuffer;
|
||||
case EVDF_VERTEX_SHADER_1_1:
|
||||
|
@ -1052,6 +1052,9 @@ class COpenGLExtensionHandler
|
||||
|
||||
bool OcclusionQuerySupport;
|
||||
|
||||
// Info needed for workarounds.
|
||||
bool IsAtiRadeonX;
|
||||
|
||||
//! Workaround until direct state access with framebuffers is stable enough in drivers
|
||||
// https://devtalk.nvidia.com/default/topic/1030494/opengl/bug-amp-amp-spec-violation-checknamedframebufferstatus-returns-gl_framebuffer_incomplete_dimensions_ext-under-gl-4-5-core/
|
||||
// https://stackoverflow.com/questions/51304706/problems-with-attaching-textures-of-different-sizes-to-fbo
|
||||
|
@ -1872,10 +1872,10 @@ ISceneNodeAnimatorCollisionResponse* CSceneManager::createCollisionResponseAnima
|
||||
//! Creates a follow spline animator.
|
||||
ISceneNodeAnimator* CSceneManager::createFollowSplineAnimator(s32 startTime,
|
||||
const core::array< core::vector3df >& points,
|
||||
f32 speed, f32 tightness, bool loop, bool pingpong)
|
||||
f32 speed, f32 tightness, bool loop, bool pingpong, bool steer)
|
||||
{
|
||||
ISceneNodeAnimator* a = new CSceneNodeAnimatorFollowSpline(startTime, points,
|
||||
speed, tightness, loop, pingpong);
|
||||
speed, tightness, loop, pingpong, steer);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ namespace scene
|
||||
//! Creates a follow spline animator.
|
||||
virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
|
||||
const core::array< core::vector3df >& points,
|
||||
f32 speed, f32 tightness, bool loop, bool pingpong) _IRR_OVERRIDE_;
|
||||
f32 speed, f32 tightness, bool loop, bool pingpong, bool steer) _IRR_OVERRIDE_;
|
||||
|
||||
|
||||
//! Creates a simple ITriangleSelector, based on a mesh.
|
||||
|
@ -13,9 +13,9 @@ namespace scene
|
||||
//! constructor
|
||||
CSceneNodeAnimatorFollowSpline::CSceneNodeAnimatorFollowSpline(u32 time,
|
||||
const core::array<core::vector3df>& points, f32 speed,
|
||||
f32 tightness, bool loop, bool pingpong)
|
||||
f32 tightness, bool loop, bool pingpong, bool steer)
|
||||
: ISceneNodeAnimatorFinishing(0), Points(points), Speed(speed), Tightness(tightness)
|
||||
, Loop(loop), PingPong(pingpong)
|
||||
, Loop(loop), PingPong(pingpong), Steer(steer)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CSceneNodeAnimatorFollowSpline");
|
||||
@ -86,7 +86,17 @@ void CSceneNodeAnimatorFollowSpline::animateNode(ISceneNode* node, u32 timeMs)
|
||||
const core::vector3df t2 = ( p3 - p1 ) * Tightness;
|
||||
|
||||
// interpolated point
|
||||
node->setPosition(p1 * h1 + p2 * h2 + t1 * h3 + t2 * h4);
|
||||
const core::vector3df lastPos(node->getPosition());
|
||||
const core::vector3df pos(p1 * h1 + p2 * h2 + t1 * h3 + t2 * h4);
|
||||
node->setPosition(pos);
|
||||
|
||||
// steering (rotate in direction of movement)
|
||||
if (Steer && !pos.equals(lastPos)) // equality check fixes glitches due to very high frame rates
|
||||
{
|
||||
const core::vector3df toTarget(pos - lastPos);
|
||||
const core::vector3df requiredRotation = toTarget.getHorizontalAngle();
|
||||
node->setRotation(requiredRotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +109,7 @@ void CSceneNodeAnimatorFollowSpline::serializeAttributes(io::IAttributes* out, i
|
||||
out->addFloat("Tightness", Tightness);
|
||||
out->addBool("Loop", Loop);
|
||||
out->addBool("PingPong", PingPong);
|
||||
out->addBool("Steer", Steer);
|
||||
|
||||
u32 count = Points.size();
|
||||
|
||||
@ -124,10 +135,11 @@ void CSceneNodeAnimatorFollowSpline::deserializeAttributes(io::IAttributes* in,
|
||||
{
|
||||
ISceneNodeAnimatorFinishing::deserializeAttributes(in, options);
|
||||
|
||||
Speed = in->getAttributeAsFloat("Speed");
|
||||
Tightness = in->getAttributeAsFloat("Tightness");
|
||||
Loop = in->getAttributeAsBool("Loop");
|
||||
PingPong = in->getAttributeAsBool("PingPong");
|
||||
Speed = in->getAttributeAsFloat("Speed", Speed);
|
||||
Tightness = in->getAttributeAsFloat("Tightness", Tightness);
|
||||
Loop = in->getAttributeAsBool("Loop", Loop);
|
||||
PingPong = in->getAttributeAsBool("PingPong", PingPong);
|
||||
Steer = in->getAttributeAsBool("Steer", Steer);
|
||||
Points.clear();
|
||||
|
||||
for(u32 i=1; true; ++i)
|
||||
|
@ -22,7 +22,7 @@ namespace scene
|
||||
//! constructor
|
||||
CSceneNodeAnimatorFollowSpline(u32 startTime,
|
||||
const core::array< core::vector3df >& points,
|
||||
f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false);
|
||||
f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false, bool steer=false);
|
||||
|
||||
//! animates a scene node
|
||||
virtual void animateNode(ISceneNode* node, u32 timeMs) _IRR_OVERRIDE_;
|
||||
@ -52,6 +52,7 @@ namespace scene
|
||||
f32 Tightness;
|
||||
bool Loop;
|
||||
bool PingPong;
|
||||
bool Steer; // rotate depending on current movement
|
||||
};
|
||||
|
||||
|
||||
|
@ -173,7 +173,7 @@ static inline float powf_limit(const float a, const float b)
|
||||
}
|
||||
|
||||
//! clamp(value,0,1)
|
||||
static inline const float clampf01(const float v)
|
||||
static inline float clampf01(const float v)
|
||||
{
|
||||
return v < 0.f ? 0.f : v > 1.f ? 1.f : v;
|
||||
}
|
||||
@ -748,9 +748,11 @@ bool CBurningVideoDriver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
static inline f32 map_value(f32 x, f32 in_min, f32 in_max, f32 out_min, f32 out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (f32)(in_max - in_min) + out_min;
|
||||
}
|
||||
*/
|
||||
|
||||
//! sets a render target
|
||||
void CBurningVideoDriver::setRenderTargetImage2(video::IImage* color, video::IImage* depth, video::IImage* stencil)
|
||||
@ -802,7 +804,7 @@ void CBurningVideoDriver::setRenderTargetImage2(video::IImage* color, video::IIm
|
||||
|
||||
// used to scale <-1,-1><1,1> to viewport [center,scale]
|
||||
// controls subtexel and fill convention.
|
||||
// Don't tweak SOFTWARE_DRIVER_2_SUBTEXEL (-0.5f in m[1]) anymore to control texture blur effect, it's used for viewport scaling.
|
||||
// Don't tweak SOFTWARE_DRIVER_2_SUBTEXEL (-0.5f in m[1]) anymore to control texture blur effect, it's used for viewport scaling.
|
||||
// naming is misleading. it will write outside memory location..
|
||||
|
||||
void buildNDCToDCMatrix(f32* m, const core::rect<s32>& viewport, f32 tx)
|
||||
@ -1603,7 +1605,7 @@ void CBurningVideoDriver::VertexCache_fill(const u32 sourceIndex, const u32 dest
|
||||
}
|
||||
|
||||
// Texture Coo Transform
|
||||
// Always set all internal uv (v1.9 SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM always on)
|
||||
// Always set all internal uv (v1.9 SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM always on)
|
||||
for (size_t t = 0; t < BURNING_MATERIAL_MAX_TEXTURES; ++t)
|
||||
{
|
||||
sVec4 r;
|
||||
@ -2166,8 +2168,8 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
|
||||
{
|
||||
// if primitive fully outside or outside on same side
|
||||
continue;
|
||||
vOut = 0;
|
||||
vertex_from_clipper = 0;
|
||||
//vOut = 0;
|
||||
//vertex_from_clipper = 0;
|
||||
}
|
||||
else if (clipMask_o == VERTEX4D_INSIDE)
|
||||
{
|
||||
@ -2256,14 +2258,14 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
|
||||
}
|
||||
lod_bias *= tex->get_lod_bias();
|
||||
//lod_bias += Material.org.TextureLayer[m].LODBias * 0.125f;
|
||||
|
||||
|
||||
s32 lodFactor = lodFactor_inside(face, m, dc_area, lod_bias);
|
||||
|
||||
CurrentShader->setTextureParam(m, tex, lodFactor);
|
||||
//currently shader receives texture coordinate as Pixelcoo of 1 Texture
|
||||
select_polygon_mipmap_inside(face, m, tex->getTexBound());
|
||||
}
|
||||
|
||||
|
||||
CurrentShader->drawWireFrameTriangle(face[0] + s4DVertex_proj(0), face[1] + s4DVertex_proj(0), face[2] + s4DVertex_proj(0));
|
||||
vertex_from_clipper = 1;
|
||||
}
|
||||
@ -3364,7 +3366,7 @@ void CBurningVideoDriver::draw3DLine(const core::vector3df& start,
|
||||
v[s4DVertex_proj(has_vertex_run)].flag = v[s4DVertex_ofs(has_vertex_run)].flag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
size_t vOut;
|
||||
|
||||
// vertices count per line
|
||||
|
@ -119,30 +119,30 @@ CSoftwareRenderTarget::CSoftwareRenderTarget(CSoftwareDriver* driver) : Driver(d
|
||||
{
|
||||
DriverType = EDT_SOFTWARE;
|
||||
|
||||
Texture.set_used(1);
|
||||
Texture[0] = 0;
|
||||
Textures.set_used(1);
|
||||
Textures[0] = 0;
|
||||
}
|
||||
|
||||
CSoftwareRenderTarget::~CSoftwareRenderTarget()
|
||||
{
|
||||
if (Texture[0])
|
||||
Texture[0]->drop();
|
||||
if (Textures[0])
|
||||
Textures[0]->drop();
|
||||
}
|
||||
|
||||
void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
void CSoftwareRenderTarget::setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces)
|
||||
{
|
||||
if (Texture != texture)
|
||||
if (!Textures.equals(textures, numTextures))
|
||||
{
|
||||
ITexture* prevTexture = Texture[0];
|
||||
ITexture* prevTexture = Textures[0];
|
||||
|
||||
bool textureDetected = false;
|
||||
|
||||
for (u32 i = 0; i < texture.size(); ++i)
|
||||
for (u32 i = 0; i < numTextures; ++i)
|
||||
{
|
||||
if (texture[i] && texture[i]->getDriverType() == EDT_SOFTWARE)
|
||||
if (textures[i] && textures[i]->getDriverType() == EDT_SOFTWARE)
|
||||
{
|
||||
Texture[0] = texture[i];
|
||||
Texture[0]->grab();
|
||||
Textures[0] = textures[i];
|
||||
Textures[0]->grab();
|
||||
textureDetected = true;
|
||||
|
||||
break;
|
||||
@ -153,13 +153,13 @@ void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, IT
|
||||
prevTexture->drop();
|
||||
|
||||
if (!textureDetected)
|
||||
Texture[0] = 0;
|
||||
Textures[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ITexture* CSoftwareRenderTarget::getTexture() const
|
||||
{
|
||||
return Texture[0];
|
||||
return Textures[0];
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
CSoftwareRenderTarget(CSoftwareDriver* driver);
|
||||
virtual ~CSoftwareRenderTarget();
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
|
||||
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) _IRR_OVERRIDE_;
|
||||
|
||||
ITexture* getTexture() const;
|
||||
|
||||
|
@ -277,7 +277,7 @@ void CSoftwareTexture2::regenerateMipMapLevels(void* data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//visualize mipmap
|
||||
for (i = 1; i < 0 && i < array_size(MipMap); ++i)
|
||||
{
|
||||
@ -327,7 +327,7 @@ void CSoftwareTexture2::regenerateMipMapLevels(void* data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
calcDerivative();
|
||||
}
|
||||
|
||||
@ -385,30 +385,30 @@ CSoftwareRenderTarget2::CSoftwareRenderTarget2(CBurningVideoDriver* driver) : Dr
|
||||
{
|
||||
DriverType = EDT_BURNINGSVIDEO;
|
||||
|
||||
Texture.set_used(1);
|
||||
Texture[0] = 0;
|
||||
Textures.set_used(1);
|
||||
Textures[0] = 0;
|
||||
}
|
||||
|
||||
CSoftwareRenderTarget2::~CSoftwareRenderTarget2()
|
||||
{
|
||||
if (Texture[0])
|
||||
Texture[0]->drop();
|
||||
if (Textures[0])
|
||||
Textures[0]->drop();
|
||||
}
|
||||
|
||||
void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
void CSoftwareRenderTarget2::setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces)
|
||||
{
|
||||
if (Texture != texture)
|
||||
if (!Textures.equals(textures, numTextures))
|
||||
{
|
||||
ITexture* prevTexture = Texture[0];
|
||||
ITexture* prevTexture = Textures[0];
|
||||
|
||||
bool textureDetected = false;
|
||||
|
||||
for (u32 i = 0; i < texture.size(); ++i)
|
||||
for (u32 i = 0; i < numTextures; ++i)
|
||||
{
|
||||
if (texture[i] && texture[i]->getDriverType() == EDT_BURNINGSVIDEO)
|
||||
if (textures[i] && textures[i]->getDriverType() == EDT_BURNINGSVIDEO)
|
||||
{
|
||||
Texture[0] = texture[i];
|
||||
Texture[0]->grab();
|
||||
Textures[0] = textures[i];
|
||||
Textures[0]->grab();
|
||||
textureDetected = true;
|
||||
|
||||
break;
|
||||
@ -419,7 +419,7 @@ void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, I
|
||||
prevTexture->drop();
|
||||
|
||||
if (!textureDetected)
|
||||
Texture[0] = 0;
|
||||
Textures[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
CSoftwareRenderTarget2(CBurningVideoDriver* driver);
|
||||
virtual ~CSoftwareRenderTarget2();
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
|
||||
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) _IRR_OVERRIDE_;
|
||||
|
||||
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
|
||||
E_DRIVER_TYPE DriverType;
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;
|
||||
virtual bool canWireFrame () { return true; }
|
||||
virtual bool canWireFrame () _IRR_OVERRIDE_ { return true; }
|
||||
|
||||
protected:
|
||||
virtual void fragmentShader();
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;
|
||||
virtual bool canWireFrame () { return true; }
|
||||
virtual bool canWireFrame () _IRR_OVERRIDE_ { return true; }
|
||||
|
||||
protected:
|
||||
virtual void fragmentShader();
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;
|
||||
virtual bool canWireFrame () { return true; }
|
||||
virtual bool canWireFrame () _IRR_OVERRIDE_ { return true; }
|
||||
|
||||
|
||||
private:
|
||||
|
@ -494,14 +494,12 @@ private:
|
||||
// finds a current attribute by name, returns 0 if not found
|
||||
const SAttribute* getAttributeByName(const char_type* name) const
|
||||
{
|
||||
if (!name)
|
||||
return 0;
|
||||
|
||||
core::string<char_type> n = name;
|
||||
|
||||
for (int i=0; i<(int)Attributes.size(); ++i)
|
||||
if (Attributes[i].Name == n)
|
||||
return &Attributes[i];
|
||||
if (name)
|
||||
{
|
||||
for (irr::u32 i=0; i<Attributes.size(); ++i)
|
||||
if (Attributes[i].Name == name)
|
||||
return &Attributes[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -644,7 +642,7 @@ private:
|
||||
//! converts the text file into the desired format.
|
||||
/** \param source: begin of the text (without byte order mark)
|
||||
\param pointerToStore: pointer to text data block which can be
|
||||
stored or deleted based on the nesessary conversion.
|
||||
stored or deleted based on the necessary conversion.
|
||||
\param sizeWithoutHeader: Text size in characters without header
|
||||
*/
|
||||
template<class src_char_type>
|
||||
|
@ -25,6 +25,7 @@ namespace irr
|
||||
EPID_SM_RENDER_SHADOWS,
|
||||
EPID_SM_RENDER_TRANSPARENT,
|
||||
EPID_SM_RENDER_EFFECT,
|
||||
EPID_SM_RENDER_GUI_NODES,
|
||||
EPID_SM_REGISTER,
|
||||
|
||||
//! octrees
|
||||
|
@ -841,8 +841,10 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\EDriverFeatures.h" />
|
||||
<ClInclude Include="..\..\include\EMaterialFlags.h" />
|
||||
<ClInclude Include="..\..\include\fast_atof.h" />
|
||||
<ClInclude Include="..\..\include\IAnimatedMeshMD3.h" />
|
||||
<ClInclude Include="..\..\include\IEventReceiver.h" />
|
||||
<ClInclude Include="..\..\include\ILightManager.h" />
|
||||
<ClInclude Include="..\..\include\ILogger.h" />
|
||||
<ClInclude Include="..\..\include\IOctreeSceneNode.h" />
|
||||
<ClInclude Include="..\..\include\IOSOperator.h" />
|
||||
@ -895,6 +897,7 @@
|
||||
<ClInclude Include="..\..\include\rect.h" />
|
||||
<ClInclude Include="..\..\include\SOverrideMaterial.h" />
|
||||
<ClInclude Include="..\..\include\SSharedMeshBuffer.h" />
|
||||
<ClInclude Include="..\..\include\SVertexManipulator.h" />
|
||||
<ClInclude Include="..\..\include\triangle3d.h" />
|
||||
<ClInclude Include="..\..\include\vector2d.h" />
|
||||
<ClInclude Include="..\..\include\vector3d.h" />
|
||||
@ -1011,7 +1014,7 @@
|
||||
<ClInclude Include="burning_shader_compile_fragment_start.h" />
|
||||
<ClInclude Include="burning_shader_compile_start.h" />
|
||||
<ClInclude Include="burning_shader_compile_triangle.h" />
|
||||
<ClInclude Include="burning_shader_compile_verify.h" />
|
||||
<ClInclude Include="burning_shader_compile_verify.h" />
|
||||
<ClInclude Include="CB3DMeshWriter.h" />
|
||||
<ClInclude Include="CD3D9RenderTarget.h" />
|
||||
<ClInclude Include="CDefaultSceneNodeAnimatorFactory.h" />
|
||||
@ -1278,7 +1281,7 @@
|
||||
<None Include="..\..\readme.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="burning_shader_color.cpp" />
|
||||
<ClCompile Include="burning_shader_color.cpp" />
|
||||
<ClCompile Include="CB3DMeshWriter.cpp" />
|
||||
<ClCompile Include="CD3D9RenderTarget.cpp" />
|
||||
<ClCompile Include="CDefaultSceneNodeAnimatorFactory.cpp" />
|
||||
@ -1330,7 +1333,7 @@
|
||||
<ClCompile Include="CQ3LevelMesh.cpp" />
|
||||
<ClCompile Include="CSkinnedMesh.cpp" />
|
||||
<ClCompile Include="CSTLMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CTRGouraudNoZ2.cpp" />
|
||||
<ClCompile Include="CTRGouraudNoZ2.cpp" />
|
||||
<ClCompile Include="CTR_transparent_reflection_2_layer.cpp" />
|
||||
<ClCompile Include="CWGLManager.cpp" />
|
||||
<ClCompile Include="CXMeshFileLoader.cpp" />
|
||||
|
@ -1390,7 +1390,7 @@
|
||||
<ClInclude Include="..\..\include\IOctreeSceneNode.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="burning_shader_color_fraq.h">
|
||||
<ClInclude Include="burning_shader_color_fraq.h">
|
||||
<Filter>Irrlicht\video\Burning Video</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="burning_shader_compile_fragment_default.h">
|
||||
@ -1411,6 +1411,15 @@
|
||||
<ClInclude Include="burning_shader_compile_verify.h">
|
||||
<Filter>Irrlicht\video\Burning Video</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\fast_atof.h">
|
||||
<Filter>include\core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\ILightManager.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SVertexManipulator.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\changes.txt">
|
||||
@ -2378,7 +2387,7 @@
|
||||
<ClCompile Include="CWGLManager.cpp">
|
||||
<Filter>Irrlicht\video\OpenGL Context</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="burning_shader_color.cpp">
|
||||
<ClCompile Include="burning_shader_color.cpp">
|
||||
<Filter>Irrlicht\video\Burning Video</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CTR_transparent_reflection_2_layer.cpp">
|
||||
|
@ -11,6 +11,10 @@ VERSION_RELEASE = 0
|
||||
# This will compile Irrlicht, create a static lib (libIrrlicht.a), and copy it
|
||||
# into the subdirectory lib/Linux. That's all.
|
||||
#
|
||||
# If you switch any settings (like debug/release/static/shared) then first run:
|
||||
#
|
||||
# make clean
|
||||
#
|
||||
# If you want Irrlicht to be compiled as shared lib (libIrrlicht.so.versionnumber), then run:
|
||||
#
|
||||
# make sharedlib
|
||||
@ -80,29 +84,25 @@ CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
|
||||
CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti
|
||||
#CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__
|
||||
ifndef NDEBUG
|
||||
CXXFLAGS += -g -D_DEBUG
|
||||
CPPFLAGS += -g -D_DEBUG
|
||||
else
|
||||
CXXFLAGS += -O3
|
||||
CPPFLAGS += -O3
|
||||
endif
|
||||
ifdef PROFILE
|
||||
CXXFLAGS += -pg
|
||||
CPPFLAGS += -pg
|
||||
endif
|
||||
CFLAGS := -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
|
||||
ifdef EMSCRIPTEN
|
||||
CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__
|
||||
ifndef NDEBUG
|
||||
CFLAGS := -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
|
||||
else
|
||||
CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
|
||||
endif
|
||||
ifdef WASM
|
||||
# TODO: shouldn't this use CPPFLAGS?
|
||||
CXXFLAGS += -s WASM=1
|
||||
endif
|
||||
else
|
||||
CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
|
||||
endif
|
||||
|
||||
sharedlib sharedlib_osx: CXXFLAGS += -fPIC
|
||||
sharedlib sharedlib_osx: CFLAGS += -fPIC
|
||||
sharedlib sharedlib_osx: CPPFLAGS += -fPIC
|
||||
# TODO: also necessary on sharedlib_osx?
|
||||
sharedlib: LDFLAGS += -fPIC
|
||||
|
||||
#multilib handling
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
|
@ -164,7 +164,7 @@ typedef union {
|
||||
unsigned int u;
|
||||
struct { unsigned int frac:23; unsigned exp:8; unsigned int sign:1; } fields;
|
||||
struct { unsigned int frac_exp:31; } abs;
|
||||
} ieee754 PACK_STRUCT;
|
||||
} PACK_STRUCT ieee754;
|
||||
|
||||
// Default alignment
|
||||
#include "irrunpack.h"
|
||||
|
@ -9,7 +9,7 @@ public:
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;
|
||||
virtual bool canWireFrame() { return true; }
|
||||
virtual bool canWireFrame() _IRR_OVERRIDE_ { return true; }
|
||||
|
||||
virtual void OnSetMaterial(const SBurningShaderMaterial& material) _IRR_OVERRIDE_;
|
||||
|
||||
|
Reference in New Issue
Block a user