Merging r5652 through r5663 from trunk to ogl-es.
This is mostly about cubemap changes. ES drivers compile, but not tested if cubemaps work with them. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5664 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
60708ed1cb
commit
252abab03d
|
@ -139,6 +139,9 @@ namespace video
|
|||
//! Support for cube map textures.
|
||||
EVDF_TEXTURE_CUBEMAP,
|
||||
|
||||
//! Support for filtering across different faces of the cubemap
|
||||
EVDF_TEXTURE_CUBEMAP_SEAMLESS,
|
||||
|
||||
//! Only used for counting the elements of this enum
|
||||
EVDF_COUNT
|
||||
};
|
||||
|
|
|
@ -318,7 +318,7 @@ public:
|
|||
enumeration string, but no information about its index.
|
||||
\return Returns value of the attribute previously set by setAttribute()
|
||||
*/
|
||||
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) const = 0;
|
||||
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;
|
||||
|
||||
//! Gets an attribute as enumeration
|
||||
/** \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||
|
@ -326,9 +326,10 @@ public:
|
|||
the index value instead of the set ones. This is useful when the
|
||||
attribute list maybe was read from an xml file, and only contains the
|
||||
enumeration string, but no information about its index.
|
||||
\param defaultNotFound Value returned when the attribute referenced by the index was not found.
|
||||
\return Returns value of the attribute previously set by setAttribute()
|
||||
*/
|
||||
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) const = 0;
|
||||
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;
|
||||
|
||||
//! Gets an attribute as enumeration
|
||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||
|
|
|
@ -94,6 +94,30 @@ enum E_TEXTURE_LOCK_MODE
|
|||
ETLM_WRITE_ONLY
|
||||
};
|
||||
|
||||
//! Additional bitflags for ITexture::lock() call
|
||||
enum E_TEXTURE_LOCK_FLAGS
|
||||
{
|
||||
ETLF_NONE = 0,
|
||||
|
||||
//! Flip left-bottom origin rendertarget textures upside-down
|
||||
/** Irrlicht usually has all textures with left-top as origin.
|
||||
And for drivers with a left-bottom origin coordinate system (OpenGL)
|
||||
Irrlicht modifies the texture-matrix in the fixed function pipeline to make
|
||||
the textures show up correctly (shader coders have to handle upside down
|
||||
textures themselves).
|
||||
But rendertarget textures (RTT's) are written by drivers the way the
|
||||
coordinate system of that driver works. So on OpenGL images tend to look
|
||||
upside down (aka Y coordinate going up) on lock() when this flag isn't set.
|
||||
When the flag is set it will flip such textures on lock() to make them look
|
||||
like non-rtt textures (origin left-top). Note that this also means the texture
|
||||
will be uploaded flipped on unlock. So mostly you want to have this flag set
|
||||
when you want to look at the texture or save it, but unset if you want to
|
||||
upload it again to the card.
|
||||
If you disable this flag you get the memory just as it is on the graphic card.
|
||||
For backward compatibility reasons this flag is enabled by default. */
|
||||
ETLF_FLIP_Y_UP_RTT = 1
|
||||
};
|
||||
|
||||
//! Where did the last IVideoDriver::getTexture call find this texture
|
||||
enum E_TEXTURE_SOURCE
|
||||
{
|
||||
|
@ -151,11 +175,15 @@ public:
|
|||
only mode or read from in write only mode.
|
||||
Support for this feature depends on the driver, so don't rely on the
|
||||
texture being write-protected when locking with read-only, etc.
|
||||
\param mipmapLevel NOTE: Currently broken, sorry, we try if we can repair it for 1.9 release.
|
||||
Number of the mipmapLevel to lock. 0 is main texture.
|
||||
Non-existing levels will silently fail and return 0.
|
||||
\param layer It determines which cubemap face or texture array layer should be locked.
|
||||
\param lockFlags See E_TEXTURE_LOCK_FLAGS documentation.
|
||||
\return Returns a pointer to the pixel data. The format of the pixel can
|
||||
be determined by using getColorFormat(). 0 is returned, if
|
||||
the texture cannot be locked. */
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 layer = 0) = 0;
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) = 0;
|
||||
|
||||
//! Unlock function. Must be called after a lock() to the texture.
|
||||
/** One should avoid to call unlock more than once before another lock.
|
||||
|
|
|
@ -361,6 +361,17 @@ namespace video
|
|||
virtual ITexture* addTextureCubemap(const io::path& name, IImage* imagePosX, IImage* imageNegX, IImage* imagePosY,
|
||||
IImage* imageNegY, IImage* imagePosZ, IImage* imageNegZ) = 0;
|
||||
|
||||
//! Creates an empty cubemap texture of specified size.
|
||||
/** \param sideLen diameter of one side of the cube
|
||||
\param name A name for the texture. Later calls of
|
||||
getTexture() with this name will return this texture.
|
||||
The name can _not_ be empty.
|
||||
\param format Desired color format of the texture. Please note
|
||||
that the driver may choose to create the texture in another
|
||||
color format.
|
||||
\return Pointer to the newly created texture. */
|
||||
virtual ITexture* addTextureCubemap(const irr::u32 sideLen, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
|
||||
|
||||
//! Adds a new render target texture to the texture cache.
|
||||
/** \param size Size of the texture, in pixels. Width and
|
||||
height should be a power of two (e.g. 64, 128, 256, 512, ...)
|
||||
|
|
|
@ -517,7 +517,7 @@ const char* CAttributes::getAttributeAsEnumeration(const c8* attributeName, cons
|
|||
}
|
||||
|
||||
//! Gets an attribute as enumeration
|
||||
s32 CAttributes::getAttributeAsEnumeration(const c8* attributeName, const char* const* enumerationLiteralsToUse) const
|
||||
s32 CAttributes::getAttributeAsEnumeration(const c8* attributeName, const char* const* enumerationLiteralsToUse, s32 defaultNotFound) const
|
||||
{
|
||||
IAttribute* att = getAttributeP(attributeName);
|
||||
|
||||
|
@ -532,7 +532,7 @@ s32 CAttributes::getAttributeAsEnumeration(const c8* attributeName, const char*
|
|||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return defaultNotFound;
|
||||
}
|
||||
|
||||
//! Gets the list of enumeration literals of an enumeration attribute
|
||||
|
@ -762,7 +762,7 @@ const char* CAttributes::getAttributeAsEnumeration(s32 index) const
|
|||
|
||||
//! Gets an attribute as enumeration
|
||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||
s32 CAttributes::getAttributeAsEnumeration(s32 index, const char* const* enumerationLiteralsToUse) const
|
||||
s32 CAttributes::getAttributeAsEnumeration(s32 index, const char* const* enumerationLiteralsToUse, s32 defaultNotFound) const
|
||||
{
|
||||
if ((u32)index < Attributes.size())
|
||||
{
|
||||
|
@ -780,7 +780,7 @@ s32 CAttributes::getAttributeAsEnumeration(s32 index, const char* const* enumera
|
|||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return defaultNotFound;
|
||||
}
|
||||
|
||||
//! Gets the list of enumeration literals of an enumeration attribute
|
||||
|
|
|
@ -290,11 +290,11 @@ public:
|
|||
//! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but
|
||||
//! no information about its index.
|
||||
//! \return Returns value of the attribute previously set by setAttribute()
|
||||
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) const _IRR_OVERRIDE_;
|
||||
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound ) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Gets an attribute as enumeration
|
||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) const _IRR_OVERRIDE_;
|
||||
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Gets an attribute as enumeration
|
||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||
|
|
|
@ -177,7 +177,7 @@ CD3D9Texture::~CD3D9Texture()
|
|||
Device->Release();
|
||||
}
|
||||
|
||||
void* CD3D9Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 layer)
|
||||
void* CD3D9Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel, u32 layer, E_TEXTURE_LOCK_FLAGS lockFlags)
|
||||
{
|
||||
if (LockData)
|
||||
return LockData;
|
||||
|
@ -216,7 +216,10 @@ void* CD3D9Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 layer)
|
|||
{
|
||||
// Make RTT surface large enough for all miplevels (including 0)
|
||||
D3DSURFACE_DESC desc;
|
||||
Texture->GetLevelDesc(0, &desc);
|
||||
if (Texture)
|
||||
Texture->GetLevelDesc(0, &desc);
|
||||
else if (CubeTexture)
|
||||
CubeTexture->GetLevelDesc(0, &desc);
|
||||
hr = Device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &RTTSurface, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -226,7 +229,10 @@ void* CD3D9Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 layer)
|
|||
}
|
||||
|
||||
IDirect3DSurface9 *surface = 0;
|
||||
hr = Texture->GetSurfaceLevel(0, &surface);
|
||||
if (Texture)
|
||||
hr = Texture->GetSurfaceLevel(0, &surface);
|
||||
else if (CubeTexture)
|
||||
hr = CubeTexture->GetCubeMapSurface(static_cast<_D3DCUBEMAP_FACES>(layer), 0, &surface);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
os::Printer::log("Could not lock DIRECT3D9 Texture", "Could not get surface.", ELL_ERROR);
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
virtual ~CD3D9Texture();
|
||||
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 layer = 0) _IRR_OVERRIDE_;
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) _IRR_OVERRIDE_;
|
||||
|
||||
virtual void unlock() _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -1659,23 +1659,25 @@ void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
|
|||
{
|
||||
IGUIEditBox::deserializeAttributes(in,options);
|
||||
|
||||
setDrawBorder( in->getAttributeAsBool("Border") );
|
||||
setDrawBackground( in->getAttributeAsBool("Background") );
|
||||
setOverrideColor(in->getAttributeAsColor("OverrideColor"));
|
||||
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
|
||||
setMax(in->getAttributeAsInt("MaxChars"));
|
||||
setWordWrap(in->getAttributeAsBool("WordWrap"));
|
||||
setMultiLine(in->getAttributeAsBool("MultiLine"));
|
||||
setAutoScroll(in->getAttributeAsBool("AutoScroll"));
|
||||
core::stringw ch = in->getAttributeAsStringW("PasswordChar");
|
||||
setDrawBorder( in->getAttributeAsBool("Border", Border) );
|
||||
setDrawBackground( in->getAttributeAsBool("Background", Background) );
|
||||
setOverrideColor(in->getAttributeAsColor("OverrideColor", OverrideColor));
|
||||
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled));
|
||||
setMax(in->getAttributeAsInt("MaxChars", Max));
|
||||
setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap));
|
||||
setMultiLine(in->getAttributeAsBool("MultiLine", MultiLine));
|
||||
setAutoScroll(in->getAttributeAsBool("AutoScroll", AutoScroll));
|
||||
core::stringw ch = L" ";
|
||||
ch[0] = PasswordChar;
|
||||
ch = in->getAttributeAsStringW("PasswordChar", ch);
|
||||
|
||||
if (!ch.size())
|
||||
setPasswordBox(in->getAttributeAsBool("PasswordBox"));
|
||||
setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox));
|
||||
else
|
||||
setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]);
|
||||
setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox), ch[0]);
|
||||
|
||||
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
|
||||
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
|
||||
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign),
|
||||
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign));
|
||||
|
||||
// setOverrideFont(in->getAttributeAsFont("OverrideFont"));
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWri
|
|||
setImage(in->getAttributeAsTexture("Texture", Texture));
|
||||
setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel));
|
||||
setColor(in->getAttributeAsColor("Color", Color));
|
||||
setScaleImage(in->getAttributeAsBool("ScaleImage", UseAlphaChannel));
|
||||
setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage));
|
||||
setSourceRect(in->getAttributeAsRect("SourceRect", SourceRect));
|
||||
|
||||
DrawBounds.UpperLeftCorner.X = in->getAttributeAsFloat("DrawBoundsX1", DrawBounds.UpperLeftCorner.X);
|
||||
|
|
|
@ -35,7 +35,7 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
|
||||
ScrollBar = new CGUIScrollBar(false, Environment, this, -1,
|
||||
ScrollBar = new CGUIScrollBar(false, Environment, this, -1,
|
||||
core::recti(0, 0, 1, 1),
|
||||
!clip);
|
||||
ScrollBar->setSubElement(true);
|
||||
|
@ -728,9 +728,9 @@ void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
|
|||
{
|
||||
clear();
|
||||
|
||||
DrawBack = in->getAttributeAsBool("DrawBack");
|
||||
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect");
|
||||
AutoScroll = in->getAttributeAsBool("AutoScroll");
|
||||
DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);
|
||||
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);
|
||||
AutoScroll = in->getAttributeAsBool("AutoScroll", AutoScroll);
|
||||
|
||||
IGUIListBox::deserializeAttributes(in,options);
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeRead
|
|||
out->addInt ("Max", Max);
|
||||
out->addInt ("SmallStep", SmallStep);
|
||||
out->addInt ("LargeStep", LargeStep);
|
||||
// CurrentIconColor - not serialized as continuiously updated
|
||||
// CurrentIconColor - not serialized as continuously updated
|
||||
}
|
||||
|
||||
|
||||
|
@ -553,13 +553,13 @@ void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeRea
|
|||
{
|
||||
IGUIScrollBar::deserializeAttributes(in,options);
|
||||
|
||||
Horizontal = in->getAttributeAsBool("Horizontal");
|
||||
setMin(in->getAttributeAsInt("Min"));
|
||||
setMax(in->getAttributeAsInt("Max"));
|
||||
setPos(in->getAttributeAsInt("Value"));
|
||||
setSmallStep(in->getAttributeAsInt("SmallStep"));
|
||||
setLargeStep(in->getAttributeAsInt("LargeStep"));
|
||||
// CurrentIconColor - not serialized as continuiously updated
|
||||
Horizontal = in->getAttributeAsBool("Horizontal", Horizontal);
|
||||
setMin(in->getAttributeAsInt("Min", Min));
|
||||
setMax(in->getAttributeAsInt("Max", Max));
|
||||
setPos(in->getAttributeAsInt("Value", Pos));
|
||||
setSmallStep(in->getAttributeAsInt("SmallStep", SmallStep));
|
||||
setLargeStep(in->getAttributeAsInt("LargeStep", LargeStep));
|
||||
// CurrentIconColor - not serialized as continuously updated
|
||||
|
||||
refreshControls();
|
||||
}
|
||||
|
|
|
@ -332,9 +332,9 @@ void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWr
|
|||
void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
|
||||
{
|
||||
IGUIElement::deserializeAttributes(in, options);
|
||||
setRange(in->getAttributeAsFloat("Min"), in->getAttributeAsFloat("Max"));
|
||||
setStepSize(in->getAttributeAsFloat("Step"));
|
||||
setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces"));
|
||||
setRange(in->getAttributeAsFloat("Min", RangeMin), in->getAttributeAsFloat("Max", RangeMax));
|
||||
setStepSize(in->getAttributeAsFloat("Step", StepSize));
|
||||
setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces", DecimalPlaces));
|
||||
setValidateOn((u32)in->getAttributeAsInt("ValidateOn", (s32)ValidateOn) );
|
||||
}
|
||||
|
||||
|
|
|
@ -590,12 +590,12 @@ void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeRea
|
|||
out->addBool ("Border", Border);
|
||||
out->addBool ("OverrideColorEnabled",OverrideColorEnabled);
|
||||
out->addBool ("OverrideBGColorEnabled",OverrideBGColorEnabled);
|
||||
out->addBool ("WordWrap", WordWrap);
|
||||
out->addBool ("WordWrap", WordWrap);
|
||||
out->addBool ("Background", Background);
|
||||
out->addBool ("RightToLeft", RightToLeft);
|
||||
out->addBool ("RestrainTextInside", RestrainTextInside);
|
||||
out->addColor ("OverrideColor", OverrideColor);
|
||||
out->addColor ("BGColor", BGColor);
|
||||
out->addColor ("BGColor", BGColor);
|
||||
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
|
||||
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
|
||||
|
||||
|
@ -608,18 +608,18 @@ void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
|
|||
{
|
||||
IGUIStaticText::deserializeAttributes(in,options);
|
||||
|
||||
Border = in->getAttributeAsBool("Border");
|
||||
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
|
||||
OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled");
|
||||
setWordWrap(in->getAttributeAsBool("WordWrap"));
|
||||
Background = in->getAttributeAsBool("Background");
|
||||
RightToLeft = in->getAttributeAsBool("RightToLeft");
|
||||
RestrainTextInside = in->getAttributeAsBool("RestrainTextInside");
|
||||
OverrideColor = in->getAttributeAsColor("OverrideColor");
|
||||
BGColor = in->getAttributeAsColor("BGColor");
|
||||
Border = in->getAttributeAsBool("Border", Border);
|
||||
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled));
|
||||
OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled", OverrideBGColorEnabled);
|
||||
setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap));
|
||||
Background = in->getAttributeAsBool("Background", Background);
|
||||
RightToLeft = in->getAttributeAsBool("RightToLeft", RightToLeft);
|
||||
RestrainTextInside = in->getAttributeAsBool("RestrainTextInside", RestrainTextInside);
|
||||
OverrideColor = in->getAttributeAsColor("OverrideColor", OverrideColor);
|
||||
BGColor = in->getAttributeAsColor("BGColor", BGColor);
|
||||
|
||||
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
|
||||
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
|
||||
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign),
|
||||
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign));
|
||||
|
||||
// OverrideFont = in->getAttributeAsFont("OverrideFont");
|
||||
}
|
||||
|
|
|
@ -132,11 +132,11 @@ void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrite
|
|||
{
|
||||
IGUITab::deserializeAttributes(in,options);
|
||||
|
||||
setNumber(in->getAttributeAsInt("TabNumber"));
|
||||
setDrawBackground(in->getAttributeAsBool("DrawBackground"));
|
||||
setBackgroundColor(in->getAttributeAsColor("BackColor"));
|
||||
setNumber(in->getAttributeAsInt("TabNumber", Number));
|
||||
setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground));
|
||||
setBackgroundColor(in->getAttributeAsColor("BackColor", BackColor));
|
||||
bool overrideColor = in->getAttributeAsBool("OverrideTextColorEnabled", OverrideTextColorEnabled);
|
||||
setTextColor(in->getAttributeAsColor("TextColor"));
|
||||
setTextColor(in->getAttributeAsColor("TextColor", TextColor));
|
||||
OverrideTextColorEnabled = overrideColor; // because setTextColor does set OverrideTextColorEnabled always to true
|
||||
|
||||
if (Parent && Parent->getType() == EGUIET_TAB_CONTROL)
|
||||
|
|
|
@ -1269,22 +1269,22 @@ void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWri
|
|||
TotalItemHeight = 0; // calculated
|
||||
TotalItemWidth = 0; // calculated
|
||||
|
||||
Clip = in->getAttributeAsBool("Clip");
|
||||
DrawBack = in->getAttributeAsBool("DrawBack");
|
||||
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect");
|
||||
Clip = in->getAttributeAsBool("Clip", Clip);
|
||||
DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);
|
||||
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);
|
||||
|
||||
CurrentResizedColumn = -1;
|
||||
ResizeStart = 0;
|
||||
ResizableColumns = in->getAttributeAsBool("ResizableColumns");
|
||||
ResizableColumns = in->getAttributeAsBool("ResizableColumns", ResizableColumns);
|
||||
|
||||
Selected = -1;
|
||||
CellWidthPadding = in->getAttributeAsInt("CellWidthPadding");
|
||||
CellHeightPadding = in->getAttributeAsInt("CellHeightPadding");
|
||||
CellWidthPadding = in->getAttributeAsInt("CellWidthPadding", CellWidthPadding);
|
||||
CellHeightPadding = in->getAttributeAsInt("CellHeightPadding", CellHeightPadding);
|
||||
ActiveTab = -1;
|
||||
Selecting = false;
|
||||
|
||||
CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames);
|
||||
DrawFlags = in->getAttributeAsInt("DrawFlags");
|
||||
CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames, (s32)CurrentOrdering);
|
||||
DrawFlags = in->getAttributeAsInt("DrawFlags", DrawFlags);
|
||||
|
||||
refreshControls();
|
||||
}
|
||||
|
|
|
@ -526,6 +526,44 @@ ITexture* CNullDriver::addTextureCubemap(const io::path& name, IImage* imagePosX
|
|||
return t;
|
||||
}
|
||||
|
||||
ITexture* CNullDriver::addTextureCubemap(const irr::u32 sideLen, const io::path& name, ECOLOR_FORMAT format)
|
||||
{
|
||||
if ( 0 == sideLen )
|
||||
return 0;
|
||||
|
||||
if (IImage::isRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (0 == name.size())
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, texture needs to have a non-empty name.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
core::array<IImage*> imageArray(6);
|
||||
for ( int i=0; i < 6; ++i )
|
||||
imageArray.push_back(new CImage(format, core::dimension2du(sideLen, sideLen)));
|
||||
|
||||
ITexture* t = 0;
|
||||
if (checkImage(imageArray))
|
||||
{
|
||||
t = createDeviceDependentTextureCubemap(name, imageArray);
|
||||
|
||||
if (t)
|
||||
{
|
||||
addTexture(t);
|
||||
t->drop();
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i=0; i < 6; ++i )
|
||||
imageArray[i]->drop();
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
//! loads a Texture
|
||||
ITexture* CNullDriver::getTexture(const io::path& filename)
|
||||
|
|
|
@ -102,6 +102,8 @@ namespace video
|
|||
virtual ITexture* addTextureCubemap(const io::path& name, IImage* imagePosX, IImage* imageNegX, IImage* imagePosY,
|
||||
IImage* imageNegY, IImage* imagePosZ, IImage* imageNegZ) _IRR_OVERRIDE_;
|
||||
|
||||
virtual ITexture* addTextureCubemap(const irr::u32 sideLen, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) _IRR_OVERRIDE_;
|
||||
|
||||
virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255,0,0,0),
|
||||
f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_;
|
||||
|
||||
|
@ -784,7 +786,7 @@ namespace video
|
|||
{
|
||||
SDummyTexture(const io::path& name, E_TEXTURE_TYPE type) : ITexture(name, type) {};
|
||||
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 layer = 0) _IRR_OVERRIDE_ { return 0; }
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) _IRR_OVERRIDE_ { return 0; }
|
||||
virtual void unlock()_IRR_OVERRIDE_ {}
|
||||
virtual void regenerateMipMapLevels(void* data = 0, u32 layer = 0) _IRR_OVERRIDE_ {}
|
||||
};
|
||||
|
|
|
@ -47,6 +47,9 @@ typedef char GLchar;
|
|||
|
||||
#define IRR_OPENGL_VERSION 20
|
||||
|
||||
// to check if this header is in the current compile unit (different GL implementation used different "GLCommon" headers in Irrlicht
|
||||
#define IRR_COMPILE_GLES2_COMMON
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
|
|
|
@ -2381,7 +2381,34 @@ COGLES2Driver::~COGLES2Driver()
|
|||
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
COGLES2Texture* renderTargetTexture = new COGLES2Texture(name, size, format, this);
|
||||
COGLES2Texture* renderTargetTexture = new COGLES2Texture(name, size, ETT_2D, format, this);
|
||||
addTexture(renderTargetTexture);
|
||||
renderTargetTexture->drop();
|
||||
|
||||
//restore mip-mapping
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, generateMipLevels);
|
||||
|
||||
return renderTargetTexture;
|
||||
}
|
||||
|
||||
ITexture* COGLES2Driver::addRenderTargetTextureCubemap(const irr::u32 sideLen, const io::path& name, const ECOLOR_FORMAT format)
|
||||
{
|
||||
//disable mip-mapping
|
||||
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
bool supportForFBO = (Feature.ColorAttachment > 0);
|
||||
|
||||
const core::dimension2d<u32> size(sideLen, sideLen);
|
||||
core::dimension2du destSize(size);
|
||||
|
||||
if (!supportForFBO)
|
||||
{
|
||||
destSize = core::dimension2d<u32>(core::min_(size.Width, ScreenSize.Width), core::min_(size.Height, ScreenSize.Height));
|
||||
destSize = destSize.getOptimalSize((size == size.getOptimalSize()), false, false);
|
||||
}
|
||||
|
||||
COGLES2Texture* renderTargetTexture = new COGLES2Texture(name, destSize, ETT_CUBEMAP, format, this);
|
||||
addTexture(renderTargetTexture);
|
||||
renderTargetTexture->drop();
|
||||
|
||||
|
|
|
@ -271,6 +271,10 @@ namespace video
|
|||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates a render target texture for a cubemap
|
||||
ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format) _IRR_OVERRIDE_;
|
||||
|
||||
virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0),
|
||||
f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -97,6 +97,9 @@ typedef char GLchar;
|
|||
|
||||
#define IRR_OPENGL_VERSION 15
|
||||
|
||||
// to check if this header is in the current compile unit (different GL implementation used different "GLCommon" headers in Irrlicht
|
||||
#define IRR_COMPILE_GLES_COMMON
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
|
|
|
@ -2698,7 +2698,7 @@ ITexture* COGLES1Driver::addRenderTargetTexture(const core::dimension2d<u32>& si
|
|||
destSize = destSize.getOptimalSize((size == size.getOptimalSize()), false, false);
|
||||
}
|
||||
|
||||
COGLES1Texture* renderTargetTexture = new COGLES1Texture(name, destSize, format, this);
|
||||
COGLES1Texture* renderTargetTexture = new COGLES1Texture(name, destSize, ETT_2D, format, this);
|
||||
addTexture(renderTargetTexture);
|
||||
renderTargetTexture->drop();
|
||||
|
||||
|
@ -2708,6 +2708,32 @@ ITexture* COGLES1Driver::addRenderTargetTexture(const core::dimension2d<u32>& si
|
|||
return renderTargetTexture;
|
||||
}
|
||||
|
||||
ITexture* COGLES1Driver::addRenderTargetTextureCubemap(const irr::u32 sideLen, const io::path& name, const ECOLOR_FORMAT format)
|
||||
{
|
||||
//disable mip-mapping
|
||||
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
bool supportForFBO = (Feature.ColorAttachment > 0);
|
||||
|
||||
const core::dimension2d<u32> size(sideLen, sideLen);
|
||||
core::dimension2du destSize(size);
|
||||
|
||||
if (!supportForFBO)
|
||||
{
|
||||
destSize = core::dimension2d<u32>(core::min_(size.Width, ScreenSize.Width), core::min_(size.Height, ScreenSize.Height));
|
||||
destSize = destSize.getOptimalSize((size == size.getOptimalSize()), false, false);
|
||||
}
|
||||
|
||||
COGLES1Texture* renderTargetTexture = new COGLES1Texture(name, destSize, ETT_CUBEMAP, format, this);
|
||||
addTexture(renderTargetTexture);
|
||||
renderTargetTexture->drop();
|
||||
|
||||
//restore mip-mapping
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, generateMipLevels);
|
||||
|
||||
return renderTargetTexture;
|
||||
}
|
||||
|
||||
//! Returns the maximum amount of primitives
|
||||
u32 COGLES1Driver::getMaximalPrimitiveCount() const
|
||||
|
|
|
@ -254,6 +254,10 @@ namespace video
|
|||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates a render target texture for a cubemap
|
||||
ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format) _IRR_OVERRIDE_;
|
||||
|
||||
virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0),
|
||||
f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -173,6 +173,9 @@ typedef char GLchar;
|
|||
|
||||
#define IRR_OPENGL_VERSION 14
|
||||
|
||||
// to check if this header is in the current compile unit (different GL implementation used different "GLCommon" headers in Irrlicht
|
||||
#define IRR_COMPILE_GL_COMMON
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_
|
||||
{
|
||||
bool textureUpdate = (Texture != texture) ? true : false;
|
||||
bool textureUpdate = (Texture != texture) || (CubeSurfaces != cubeSurfaces) ? true : false;
|
||||
bool depthStencilUpdate = (DepthStencil != depthStencil) ? true : false;
|
||||
|
||||
if (textureUpdate || depthStencilUpdate)
|
||||
|
@ -69,6 +69,8 @@ public:
|
|||
|
||||
if (textureUpdate)
|
||||
{
|
||||
CubeSurfaces = cubeSurfaces;
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
|
@ -94,10 +96,7 @@ public:
|
|||
|
||||
if (currentTexture)
|
||||
{
|
||||
if (currentTexture->getType() == ETT_2D)
|
||||
textureID = currentTexture->getOpenGLTextureName();
|
||||
else
|
||||
os::Printer::log("This driver doesn't support render to cubemaps.", ELL_WARNING);
|
||||
textureID = currentTexture->getOpenGLTextureName();
|
||||
}
|
||||
|
||||
if (textureID != 0)
|
||||
|
@ -123,11 +122,11 @@ public:
|
|||
GLuint textureID = 0;
|
||||
|
||||
if (currentTexture)
|
||||
{
|
||||
{
|
||||
if (currentTexture->getType() == ETT_2D)
|
||||
textureID = currentTexture->getOpenGLTextureName();
|
||||
else
|
||||
os::Printer::log("This driver doesn't support render to cubemaps.", ELL_WARNING);
|
||||
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
|
||||
}
|
||||
|
||||
const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN;
|
||||
|
@ -178,12 +177,17 @@ public:
|
|||
|
||||
for (u32 i = 0; i < textureSize; ++i)
|
||||
{
|
||||
GLuint textureID = (Texture[i]) ? static_cast<TOpenGLTexture*>(Texture[i])->getOpenGLTextureName() : 0;
|
||||
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Texture[i]);
|
||||
GLuint textureID = currentTexture ? currentTexture->getOpenGLTextureName() : 0;
|
||||
|
||||
if (textureID != 0)
|
||||
{
|
||||
AssignedTexture[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, textureID, 0);
|
||||
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);
|
||||
#ifdef _DEBUG
|
||||
Driver->testGLError(__LINE__);
|
||||
#endif
|
||||
}
|
||||
else if (AssignedTexture[i] != GL_NONE)
|
||||
{
|
||||
|
@ -280,6 +284,11 @@ public:
|
|||
|
||||
Driver->irrGlDrawBuffers(bufferCount, AssignedTexture.pointer());
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
Driver->testGLError(__LINE__);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -51,13 +51,8 @@ public:
|
|||
{
|
||||
_IRR_DEBUG_BREAK_IF(image.size() == 0)
|
||||
|
||||
const GLenum textureType[2] =
|
||||
{
|
||||
GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP
|
||||
};
|
||||
|
||||
DriverType = Driver->getDriverType();
|
||||
TextureType = textureType[static_cast<int>(Type)];
|
||||
TextureType = TextureTypeIrrToGL(Type);
|
||||
HasMipMaps = Driver->getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
AutoGenerateMipMaps = Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE);
|
||||
KeepImage = Driver->getTextureCreationFlag(ETCF_ALLOW_MEMORY_COPY);
|
||||
|
@ -135,11 +130,14 @@ public:
|
|||
Driver->testGLError(__LINE__);
|
||||
}
|
||||
|
||||
COpenGLCoreTexture(const io::path& name, const core::dimension2d<u32>& size, ECOLOR_FORMAT format, TOpenGLDriver* driver) : ITexture(name, ETT_2D), Driver(driver), TextureType(GL_TEXTURE_2D),
|
||||
COpenGLCoreTexture(const io::path& name, const core::dimension2d<u32>& size, E_TEXTURE_TYPE type, ECOLOR_FORMAT format, TOpenGLDriver* driver)
|
||||
: ITexture(name, type),
|
||||
Driver(driver), TextureType(GL_TEXTURE_2D),
|
||||
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_RGBA), PixelType(GL_UNSIGNED_BYTE), Converter(0), LockReadOnly(false), LockImage(0), LockLayer(0), KeepImage(false),
|
||||
AutoGenerateMipMaps(false)
|
||||
{
|
||||
DriverType = Driver->getDriverType();
|
||||
TextureType = TextureTypeIrrToGL(Type);
|
||||
HasMipMaps = false;
|
||||
IsRenderTarget = true;
|
||||
|
||||
|
@ -165,20 +163,34 @@ public:
|
|||
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
||||
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
#if defined(GL_VERSION_1_2)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
#endif
|
||||
|
||||
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
|
||||
StatesCache.WrapV = ETC_CLAMP_TO_EDGE;
|
||||
StatesCache.WrapW = ETC_CLAMP_TO_EDGE;
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
switch (Type)
|
||||
{
|
||||
case ETT_2D:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
break;
|
||||
case ETT_CUBEMAP:
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
|
||||
if ( Driver->testGLError(__LINE__) )
|
||||
|
@ -203,7 +215,7 @@ public:
|
|||
Image[i]->drop();
|
||||
}
|
||||
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 layer = 0) _IRR_OVERRIDE_
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) _IRR_OVERRIDE_
|
||||
{
|
||||
if (LockImage)
|
||||
return LockImage->getData();
|
||||
|
@ -227,9 +239,13 @@ public:
|
|||
|
||||
if (LockImage && mode != ETLM_WRITE_ONLY)
|
||||
{
|
||||
IImage* tmpImage = Driver->createImage(ECF_A8R8G8B8, Size);
|
||||
bool passed = true;
|
||||
|
||||
#ifdef IRR_COMPILE_GL_COMMON
|
||||
IImage* tmpImage = LockImage; // not sure yet if the size required by glGetTexImage is always correct, if not we might have to allocate a different tmpImage and convert colors later on.
|
||||
|
||||
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
||||
|
||||
#if 0 // This method doesn't work properly in some cases
|
||||
GLenum tmpTextureType = TextureType;
|
||||
|
||||
if (tmpTextureType == GL_TEXTURE_CUBE_MAP)
|
||||
|
@ -239,9 +255,9 @@ public:
|
|||
tmpTextureType = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
|
||||
}
|
||||
|
||||
glGetTexImage(tmpTextureType, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->getData());
|
||||
glGetTexImage(tmpTextureType, 0, PixelFormat, PixelType, tmpImage->getData());
|
||||
|
||||
if (IsRenderTarget)
|
||||
if (IsRenderTarget && lockFlags == ETLF_FLIP_Y_UP_RTT)
|
||||
{
|
||||
const s32 pitch = tmpImage->getPitch();
|
||||
|
||||
|
@ -261,8 +277,8 @@ public:
|
|||
|
||||
delete[] tmpBuffer;
|
||||
}
|
||||
#else
|
||||
COpenGLCoreTexture* tmpTexture = new COpenGLCoreTexture("OGL_CORE_LOCK_TEXTURE", Size, ColorFormat, Driver);
|
||||
#elif (defined(IRR_COMPILE_GLES2_COMMON) || defined(IRR_COMPILE_GLES_COMMON))
|
||||
COpenGLCoreTexture* tmpTexture = new COpenGLCoreTexture("OGL_CORE_LOCK_TEXTURE", Size, ETT_2D, ColorFormat, Driver);
|
||||
|
||||
GLuint tmpFBO = 0;
|
||||
Driver->irrGlGenFramebuffers(1, &tmpFBO);
|
||||
|
@ -284,6 +300,7 @@ public:
|
|||
|
||||
Driver->draw2DImage(this, layer, true);
|
||||
|
||||
IImage* tmpImage = Driver->createImage(ECF_A8R8G8B8, Size);
|
||||
glReadPixels(0, 0, Size.Width, Size.Height, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->getData());
|
||||
|
||||
Driver->getCacheHandler()->setFBO(prevFBO);
|
||||
|
@ -291,12 +308,10 @@ public:
|
|||
|
||||
Driver->irrGlDeleteFramebuffers(1, &tmpFBO);
|
||||
delete tmpTexture;
|
||||
#endif
|
||||
|
||||
void* src = tmpImage->getData();
|
||||
void* dest = LockImage->getData();
|
||||
|
||||
bool passed = true;
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
|
@ -315,8 +330,8 @@ public:
|
|||
passed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
tmpImage->drop();
|
||||
#endif
|
||||
|
||||
if (!passed)
|
||||
{
|
||||
|
@ -326,6 +341,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
Driver->testGLError(__LINE__);
|
||||
|
||||
return (LockImage) ? LockImage->getData() : 0;
|
||||
}
|
||||
|
||||
|
@ -570,6 +587,20 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
GLenum TextureTypeIrrToGL(E_TEXTURE_TYPE type) const
|
||||
{
|
||||
switch ( type)
|
||||
{
|
||||
case ETT_2D:
|
||||
return GL_TEXTURE_2D;
|
||||
case ETT_CUBEMAP:
|
||||
return GL_TEXTURE_CUBE_MAP;
|
||||
}
|
||||
|
||||
os::Printer::log("COpenGLCoreTexture::TextureTypeIrrToGL unknown texture type", ELL_WARNING);
|
||||
return GL_TEXTURE_2D;
|
||||
}
|
||||
|
||||
TOpenGLDriver* Driver;
|
||||
|
||||
GLenum TextureType;
|
||||
|
|
|
@ -2024,6 +2024,19 @@ ITexture* COpenGLDriver::createDeviceDependentTextureCubemap(const io::path& nam
|
|||
return texture;
|
||||
}
|
||||
|
||||
void COpenGLDriver::disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag)
|
||||
{
|
||||
CNullDriver::disableFeature(feature, flag);
|
||||
|
||||
if ( feature == EVDF_TEXTURE_CUBEMAP_SEAMLESS )
|
||||
{
|
||||
if ( queryFeature(feature) )
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
else if (COpenGLExtensionHandler::queryFeature(feature))
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
}
|
||||
}
|
||||
|
||||
//! Sets a material. All 3d drawing functions draw geometry now using this material.
|
||||
void COpenGLDriver::setMaterial(const SMaterial& material)
|
||||
{
|
||||
|
@ -3742,7 +3755,35 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<u32>& si
|
|||
destSize = destSize.getOptimalSize((size == size.getOptimalSize()), false, false);
|
||||
}
|
||||
|
||||
COpenGLTexture* renderTargetTexture = new COpenGLTexture(name, destSize, format, this);
|
||||
COpenGLTexture* renderTargetTexture = new COpenGLTexture(name, destSize, ETT_2D, format, this);
|
||||
addTexture(renderTargetTexture);
|
||||
renderTargetTexture->drop();
|
||||
|
||||
//restore mip-mapping
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, generateMipLevels);
|
||||
|
||||
return renderTargetTexture;
|
||||
}
|
||||
|
||||
//! Creates a render target texture for a cubemap
|
||||
ITexture* COpenGLDriver::addRenderTargetTextureCubemap(const irr::u32 sideLen, const io::path& name, const ECOLOR_FORMAT format)
|
||||
{
|
||||
//disable mip-mapping
|
||||
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
bool supportForFBO = (Feature.ColorAttachment > 0);
|
||||
|
||||
const core::dimension2d<u32> size(sideLen, sideLen);
|
||||
core::dimension2du destSize(size);
|
||||
|
||||
if (!supportForFBO)
|
||||
{
|
||||
destSize = core::dimension2d<u32>(core::min_(size.Width, ScreenSize.Width), core::min_(size.Height, ScreenSize.Height));
|
||||
destSize = destSize.getOptimalSize((size == size.getOptimalSize()), false, false);
|
||||
}
|
||||
|
||||
COpenGLTexture* renderTargetTexture = new COpenGLTexture(name, destSize, ETT_CUBEMAP, format, this);
|
||||
addTexture(renderTargetTexture);
|
||||
renderTargetTexture->drop();
|
||||
|
||||
|
|
|
@ -132,6 +132,9 @@ namespace video
|
|||
return FeatureEnabled[feature] && COpenGLExtensionHandler::queryFeature(feature);
|
||||
}
|
||||
|
||||
//! Disable a feature of the driver.
|
||||
virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true) _IRR_OVERRIDE_;
|
||||
|
||||
//! Sets a material. All 3d drawing functions draw geometry now
|
||||
//! using this material.
|
||||
//! \param material: Material to be used from now on.
|
||||
|
@ -337,6 +340,10 @@ namespace video
|
|||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates a render target texture for a cubemap
|
||||
ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format) _IRR_OVERRIDE_;
|
||||
|
||||
virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255,0,0,0),
|
||||
f32 clearDepth = 1.f, u8 clearStencil = 0) _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -106,10 +106,10 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
|||
}
|
||||
|
||||
|
||||
void COpenGLExtensionHandler::dump() const
|
||||
void COpenGLExtensionHandler::dump(ELOG_LEVEL logLevel) const
|
||||
{
|
||||
for (u32 i=0; i<IRR_OpenGL_Feature_Count; ++i)
|
||||
os::Printer::log(OpenGLFeatureStrings[i], FeatureAvailable[i]?" true":" false");
|
||||
os::Printer::log(OpenGLFeatureStrings[i], FeatureAvailable[i]?" true":" false", logLevel);
|
||||
}
|
||||
|
||||
|
||||
|
@ -747,6 +747,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||
os::Printer::log("Free render buffer memory (kB)", core::stringc(val[0]));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (queryFeature(EVDF_TEXTURE_CUBEMAP_SEAMLESS))
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -824,6 +828,8 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
|||
return FeatureAvailable[IRR_EXT_texture_compression_s3tc];
|
||||
case EVDF_TEXTURE_CUBEMAP:
|
||||
return (Version >= 130) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
|
||||
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:
|
||||
return FeatureAvailable[IRR_ARB_seamless_cube_map];
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -1008,8 +1008,8 @@ class COpenGLExtensionHandler
|
|||
return FeatureAvailable[feature];
|
||||
}
|
||||
|
||||
//! show all features with availablity
|
||||
void dump() const;
|
||||
//! show all features with availability
|
||||
void dump(ELOG_LEVEL logLevel) const;
|
||||
|
||||
void dumpFramebufferFormats() const;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ CSoftwareTexture::~CSoftwareTexture()
|
|||
|
||||
|
||||
//! lock function
|
||||
void* CSoftwareTexture::lock(E_TEXTURE_LOCK_MODE mode, u32 layer)
|
||||
void* CSoftwareTexture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel, u32 layer, E_TEXTURE_LOCK_FLAGS lockFlags)
|
||||
{
|
||||
return Image->getData();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
virtual ~CSoftwareTexture();
|
||||
|
||||
//! lock function
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 layer = 0) _IRR_OVERRIDE_;
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) _IRR_OVERRIDE_;
|
||||
|
||||
//! unlock function
|
||||
virtual void unlock() _IRR_OVERRIDE_;
|
||||
|
|
|
@ -38,11 +38,11 @@ public:
|
|||
virtual ~CSoftwareTexture2();
|
||||
|
||||
//! lock function
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode, u32 level, u32 layer)
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel, u32 layer, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) _IRR_OVERRIDE_
|
||||
{
|
||||
if (Flags & GEN_MIPMAP)
|
||||
{
|
||||
MipMapLOD = level;
|
||||
MipMapLOD = mipmapLevel;
|
||||
Size = MipMap[MipMapLOD]->getDimension();
|
||||
Pitch = MipMap[MipMapLOD]->getPitch();
|
||||
}
|
||||
|
@ -50,12 +50,6 @@ public:
|
|||
return MipMap[MipMapLOD]->getData();
|
||||
}
|
||||
|
||||
//! lock function
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 layer = 0) _IRR_OVERRIDE_
|
||||
{
|
||||
return lock(mode, 0, layer);
|
||||
}
|
||||
|
||||
//! unlock function
|
||||
virtual void unlock() _IRR_OVERRIDE_
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ bool CWGLManager::initialize(const SIrrlichtCreationParameters& params, const SE
|
|||
}
|
||||
|
||||
SetPixelFormat(HDc, PixelFormat, &pfd);
|
||||
os::Printer::log("Temporary context");
|
||||
os::Printer::log("Create temporary GL rendering context", ELL_DEBUG);
|
||||
HGLRC hrc=wglCreateContext(HDc);
|
||||
if (!hrc)
|
||||
{
|
||||
|
@ -409,13 +409,14 @@ bool CWGLManager::generateContext()
|
|||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 1,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
// WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB, // enable to get a debug context (depends on driver if that does anything)
|
||||
0
|
||||
};
|
||||
hrc=wglCreateContextAttribs_ARB(HDc, 0, iAttribs);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
hrc=wglCreateContext(HDc);
|
||||
hrc=wglCreateContext(HDc);
|
||||
os::Printer::log("Irrlicht context");
|
||||
|
||||
if (!hrc)
|
||||
|
|
|
@ -46,10 +46,11 @@ int main(int argumentCount, char * arguments[])
|
|||
// Use an STL vector so that we don't rely on Irrlicht.
|
||||
std::vector<STestDefinition> tests;
|
||||
|
||||
// Note that to interactively debug a test, you will generally want to move it
|
||||
// (temporarily) to the beginning of the list, since each test runs in its own
|
||||
// process.
|
||||
|
||||
#if 0
|
||||
// To interactively debug a test, move it (temporarily) in here and enable the define to only run this test
|
||||
// Otherwise debugging is slightly tricky as each test runs in it's own process.
|
||||
TEST(textureFeatures);
|
||||
#else
|
||||
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
|
||||
// Now the simple tests without device
|
||||
TEST(testIrrArray);
|
||||
|
@ -130,6 +131,7 @@ int main(int argumentCount, char * arguments[])
|
|||
TEST(lightMaps);
|
||||
TEST(triangleSelector);
|
||||
TEST(line2DTest);
|
||||
#endif
|
||||
|
||||
unsigned int numberOfTests = tests.size();
|
||||
unsigned int testToRun = 0;
|
||||
|
|
|
@ -190,7 +190,7 @@ bool rttAndZBuffer(video::E_DRIVER_TYPE driverType)
|
|||
|
||||
{
|
||||
vd->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 0, 0, 0));
|
||||
vd->setRenderTargetEx(renderTarget, 0, video::ECBF_COLOR | video::ECBF_DEPTH);
|
||||
vd->setRenderTargetEx(renderTarget, video::ECBF_COLOR | video::ECBF_DEPTH);
|
||||
sm->drawAll();
|
||||
vd->setRenderTargetEx(0, 0, 0);
|
||||
vd->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||
|
@ -241,7 +241,7 @@ bool rttAndText(video::E_DRIVER_TYPE driverType)
|
|||
|
||||
stabilizeScreenBackground(driver);
|
||||
|
||||
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255, 255, 255));
|
||||
driver->beginScene(0, video::SColor(255,255, 255, 255));
|
||||
driver->setRenderTargetEx(renderTarget, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,0,255));
|
||||
driver->draw2DImage(driver->getTexture("../media/fireball.bmp"), core::recti(0, 0, renderTargetTex->getSize().Width, renderTargetTex->getSize().Height), core::recti(0, 0, 64, 64));
|
||||
guienv->getBuiltInFont()->draw(L"OMGGG =!", core::rect<s32>(120, 100, 256, 256), video::SColor(255, 0, 0, 255));
|
||||
|
@ -286,7 +286,7 @@ static void Render(IrrlichtDevice* device, video::IRenderTarget* rt, core::vecto
|
|||
core::vector3df& pos2, scene::IAnimatedMesh* sphereMesh, core::vector3df& pos3, core::vector3df& pos4)
|
||||
{
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
driver->setRenderTargetEx(rt, 0, video::ECBF_COLOR | video::ECBF_DEPTH);
|
||||
driver->setRenderTargetEx(rt, video::ECBF_COLOR | video::ECBF_DEPTH);
|
||||
device->getSceneManager()->drawAll();
|
||||
|
||||
video::SMaterial mat;
|
||||
|
@ -394,11 +394,12 @@ bool rttAndAntiAliasing(video::E_DRIVER_TYPE driverType)
|
|||
#if 1
|
||||
st->setText(L"Texture Rendering");
|
||||
Render(device, renderTarget1, pos1, pos2, sphereMesh, pos3, pos4);
|
||||
|
||||
Render(device, renderTarget2, pos1, pos2, sphereMesh, pos3, pos4);
|
||||
Render(device, renderTarget3, pos1, pos2, sphereMesh, pos3, pos4);
|
||||
Render(device, renderTarget4, pos1, pos2, sphereMesh, pos3, pos4);
|
||||
|
||||
device->getVideoDriver()->setRenderTargetEx(0, 0, 0);
|
||||
device->getVideoDriver()->setRenderTargetEx(0, video::ECBF_COLOR | video::ECBF_DEPTH);
|
||||
device->getVideoDriver()->draw2DImage(renderTargetTex1, core::position2di(0, 0));
|
||||
device->getVideoDriver()->draw2DImage(renderTargetTex2, core::position2di(80, 0));
|
||||
device->getVideoDriver()->draw2DImage(renderTargetTex3, core::position2di(0, 60));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Tests finished. 1 test of 1 passed.
|
||||
Compiled as DEBUG
|
||||
Test suite pass at GMT Tue Nov 7 00:42:08 2017
|
||||
|
||||
Tests finished. 1 test of 1 passed.
|
||||
Compiled as DEBUG
|
||||
Test suite pass at GMT Mon Nov 19 21:48:32 2018
|
||||
|
||||
|
|
Loading…
Reference in New Issue