mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +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:
@ -282,7 +282,7 @@ void CGLXManager::terminate()
|
||||
{
|
||||
if (libHandle)
|
||||
dlclose(libHandle);
|
||||
memset(&CurrentContext, 0, sizeof(CurrentContext));
|
||||
memset((void*)&CurrentContext, 0, sizeof(CurrentContext));
|
||||
}
|
||||
|
||||
bool CGLXManager::generateSurface()
|
||||
|
@ -637,8 +637,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)
|
||||
{
|
||||
@ -894,11 +894,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;
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -96,9 +96,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_
|
||||
};
|
||||
|
||||
|
@ -93,7 +93,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);
|
||||
|
@ -150,7 +150,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);
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
createInputContext();
|
||||
#endif
|
||||
@ -438,12 +439,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);
|
||||
@ -2076,6 +2090,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)
|
||||
@ -2083,6 +2100,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
|
||||
@ -117,7 +121,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_
|
||||
@ -211,22 +215,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);
|
||||
}
|
||||
@ -340,6 +376,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
|
||||
|
@ -840,7 +840,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;
|
||||
|
@ -103,7 +103,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;
|
||||
@ -58,7 +58,7 @@ namespace video
|
||||
virtual void* getProcAddress(const std::string &procName) _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;
|
||||
|
||||
@ -869,8 +869,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
|
||||
);
|
||||
}
|
||||
@ -1605,7 +1605,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);
|
||||
@ -2765,9 +2767,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;
|
||||
|
@ -358,11 +358,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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user