Merge revisions r5540 through r5547 from trunk to ogl-es
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5548 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
44b211800b
commit
3a1a4a78ea
|
@ -10,6 +10,10 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- Reduce log-messages for "loaded texture" and "loaded mesh" from ELL_INFORMATION to ELL_DEBUG.
|
||||
- Add IGUIButton::setOverrideColor to allow overriding text-color (same function as statictexts and editboxes have).
|
||||
- Add functions IGUIButton::getClickShiftState and IGUIButton::getClickControlState to get shift/ctrl key-state when a button was clicked. Thanks @StarSonata for patch.
|
||||
- Add function ISceneManager::clearAllRegisteredNodesForRendering.
|
||||
- Add function IVideoDriver::queryTextureFormat to allow checking if a driver supports textures with a specific color format.
|
||||
- ISceneManager::getMesh can now creates meshes with alternative cache-names.
|
||||
- Lets the BSP loader find textures inserted with relative paths. Thx@ curaga for patch
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
android:label="HelloWorldMobile"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:screenOrientation="portrait"
|
||||
android:clearTaskOnLaunch="true">
|
||||
<meta-data android:name="android.app.lib_name" android:value="HelloWorldMobile" />
|
||||
<intent-filter>
|
||||
|
|
|
@ -242,7 +242,7 @@ void android_main(android_app* app)
|
|||
SIrrlichtCreationParameters param;
|
||||
// param.DriverType = EDT_OGLES1; // android:glEsVersion in AndroidManifest.xml should be "0x00010000" (requesting 0x00020000 will also guarantee that ES1 works)
|
||||
param.DriverType = EDT_OGLES2; // android:glEsVersion in AndroidManifest.xml should be "0x00020000"
|
||||
param.WindowSize = dimension2d<u32>(0,0); // using 0,0 it will automatically set it to the maximal size
|
||||
param.WindowSize = dimension2d<u32>(300,300); // using 0,0 it will automatically set it to the maximal size
|
||||
param.PrivateData = app;
|
||||
param.Bits = 24;
|
||||
param.ZBufferBits = 16;
|
||||
|
|
|
@ -265,7 +265,7 @@ void loadModel(const c8* fn)
|
|||
|
||||
/*
|
||||
Function createToolBox() creates a toolbox window. In this simple mesh
|
||||
viewer, this toolbox only contains a controls to change the scale
|
||||
viewer, this toolbox only contains a controls to change the scale
|
||||
and animation speed of the model and a control to set the transparency
|
||||
of the GUI-elements.
|
||||
*/
|
||||
|
@ -944,9 +944,9 @@ int main(int argc, char* argv[])
|
|||
Device->setWindowCaption(Caption.c_str());
|
||||
|
||||
/*
|
||||
Now we show the about message box at start up, and load the first model.
|
||||
To make everything look better a skybox is created. We also add a user
|
||||
controlled camera, to make the application more interactive.
|
||||
Now we show the about message box at start up, and load the first model.
|
||||
To make everything look better a skybox is created. We also add a user
|
||||
controlled camera, to make the application more interactive.
|
||||
Finally, everything is drawn in a standard drawing loop.
|
||||
*/
|
||||
|
||||
|
|
|
@ -128,6 +128,27 @@ namespace gui
|
|||
font of the active skin otherwise */
|
||||
virtual IGUIFont* getActiveFont() const = 0;
|
||||
|
||||
//! Sets another color for the button text.
|
||||
/** When set, this color is used instead of EGDC_BUTTON_TEXT/EGDC_GRAY_TEXT.
|
||||
You don't need to call enableOverrideColor(true), that's done by this function.
|
||||
If you want the the color of the skin back, call enableOverrideColor(false);
|
||||
\param color: New color of the text. */
|
||||
virtual void setOverrideColor(video::SColor color) = 0;
|
||||
|
||||
//! Gets the override color
|
||||
/** \return: The override color */
|
||||
virtual video::SColor getOverrideColor(void) const = 0;
|
||||
|
||||
//! Sets if the button text should use the override color or the color in the gui skin.
|
||||
/** \param enable: If set to true, the override color, which can be set
|
||||
with IGUIStaticText::setOverrideColor is used, otherwise the
|
||||
EGDC_BUTTON_TEXT or EGDC_GRAY_TEXT color of the skin. */
|
||||
virtual void enableOverrideColor(bool enable) = 0;
|
||||
|
||||
//! Checks if an override color is enabled
|
||||
/** \return true if the override color is enabled, false otherwise */
|
||||
virtual bool isOverrideColorEnabled(void) const = 0;
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in the given state.
|
||||
/** Only one image-state can be active at a time. Images are drawn below sprites.
|
||||
If a state is without image it will try to use images from other states as described
|
||||
|
@ -225,6 +246,14 @@ namespace gui
|
|||
|
||||
//! Checks whether the button scales the used images
|
||||
virtual bool isScalingImage() const = 0;
|
||||
|
||||
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
|
||||
/** Generated together with event, so info is available in the event-receiver. */
|
||||
virtual bool getClickShiftState() const = 0;
|
||||
|
||||
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
|
||||
/** Generated together with event, so info is available in the event-receiver. */
|
||||
virtual bool getClickControlState() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1119,6 +1119,12 @@ namespace scene
|
|||
virtual u32 registerNodeForRendering(ISceneNode* node,
|
||||
E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
|
||||
|
||||
//! Clear all nodes which are currently registered for rendering
|
||||
/** Usually you don't have to care about this as drawAll will clear nodes
|
||||
after rendering them. But sometimes you might have to manully reset this.
|
||||
For example when you deleted nodes between registering and rendering. */
|
||||
virtual void clearAllRegisteredNodesForRendering() = 0;
|
||||
|
||||
//! Draws all the scene nodes.
|
||||
/** This can only be invoked between
|
||||
IVideoDriver::beginScene() and IVideoDriver::endScene(). Please note that
|
||||
|
|
|
@ -21,7 +21,9 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
s32 id, core::rect<s32> rectangle, bool noclip)
|
||||
: IGUIButton(environment, parent, id, rectangle),
|
||||
SpriteBank(0), OverrideFont(0),
|
||||
OverrideColorEnabled(false), OverrideColor(video::SColor(101,255,255,255)),
|
||||
ClickTime(0), HoverTime(0), FocusTime(0),
|
||||
ClickShiftState(false), ClickControlState(false),
|
||||
IsPushButton(false), Pressed(false),
|
||||
UseAlphaChannel(false), DrawBorder(true), ScaleImage(false)
|
||||
{
|
||||
|
@ -146,6 +148,9 @@ bool CGUIButton::OnEvent(const SEvent& event)
|
|||
|
||||
if (Parent)
|
||||
{
|
||||
ClickShiftState = event.KeyInput.Shift;
|
||||
ClickControlState = event.KeyInput.Control;
|
||||
|
||||
SEvent newEvent;
|
||||
newEvent.EventType = EET_GUI_EVENT;
|
||||
newEvent.GUIEvent.Caller = this;
|
||||
|
@ -205,6 +210,9 @@ bool CGUIButton::OnEvent(const SEvent& event)
|
|||
if ((!IsPushButton && wasPressed && Parent) ||
|
||||
(IsPushButton && wasPressed != Pressed))
|
||||
{
|
||||
ClickShiftState = event.MouseInput.Shift;
|
||||
ClickControlState = event.MouseInput.Control;
|
||||
|
||||
SEvent newEvent;
|
||||
newEvent.EventType = EET_GUI_EVENT;
|
||||
newEvent.GUIEvent.Caller = this;
|
||||
|
@ -320,7 +328,7 @@ void CGUIButton::draw()
|
|||
|
||||
if (font)
|
||||
font->draw(Text.c_str(), rect,
|
||||
skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
|
||||
OverrideColorEnabled ? OverrideColor : skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
|
||||
true, true, &AbsoluteClippingRect);
|
||||
}
|
||||
|
||||
|
@ -447,6 +455,28 @@ IGUIFont* CGUIButton::getActiveFont() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
//! Sets another color for the text.
|
||||
void CGUIButton::setOverrideColor(video::SColor color)
|
||||
{
|
||||
OverrideColor = color;
|
||||
OverrideColorEnabled = true;
|
||||
}
|
||||
|
||||
video::SColor CGUIButton::getOverrideColor() const
|
||||
{
|
||||
return OverrideColor;
|
||||
}
|
||||
|
||||
void CGUIButton::enableOverrideColor(bool enable)
|
||||
{
|
||||
OverrideColorEnabled = enable;
|
||||
}
|
||||
|
||||
bool CGUIButton::isOverrideColorEnabled() const
|
||||
{
|
||||
return OverrideColorEnabled;
|
||||
}
|
||||
|
||||
void CGUIButton::setImage(EGUI_BUTTON_IMAGE_STATE state, video::ITexture* image, const core::rect<s32>& sourceRect)
|
||||
{
|
||||
if ( state >= EGBIS_COUNT )
|
||||
|
|
|
@ -44,6 +44,18 @@ namespace gui
|
|||
//! Get the font which is used right now for drawing
|
||||
virtual IGUIFont* getActiveFont() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Sets another color for the button text.
|
||||
virtual void setOverrideColor(video::SColor color) _IRR_OVERRIDE_;
|
||||
|
||||
//! Gets the override color
|
||||
virtual video::SColor getOverrideColor(void) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Sets if the button text should use the override color or the color in the gui skin.
|
||||
virtual void enableOverrideColor(bool enable) _IRR_OVERRIDE_;
|
||||
|
||||
//! Checks if an override color is enabled
|
||||
virtual bool isOverrideColorEnabled(void) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in the given state.
|
||||
virtual void setImage(EGUI_BUTTON_IMAGE_STATE state, video::ITexture* image=0, const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) _IRR_OVERRIDE_;
|
||||
|
||||
|
@ -128,6 +140,18 @@ namespace gui
|
|||
//! Checks whether the button scales the used images
|
||||
virtual bool isScalingImage() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
|
||||
virtual bool getClickShiftState() const _IRR_OVERRIDE_
|
||||
{
|
||||
return ClickShiftState;
|
||||
}
|
||||
|
||||
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
|
||||
virtual bool getClickControlState() const _IRR_OVERRIDE_
|
||||
{
|
||||
return ClickControlState;
|
||||
}
|
||||
|
||||
//! Writes attributes of the element.
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
|
||||
|
||||
|
@ -205,8 +229,14 @@ namespace gui
|
|||
|
||||
IGUIFont* OverrideFont;
|
||||
|
||||
bool OverrideColorEnabled;
|
||||
video::SColor OverrideColor;
|
||||
|
||||
u32 ClickTime, HoverTime, FocusTime;
|
||||
|
||||
bool ClickShiftState;
|
||||
bool ClickControlState;
|
||||
|
||||
bool IsPushButton;
|
||||
bool Pressed;
|
||||
bool UseAlphaChannel;
|
||||
|
|
|
@ -648,7 +648,7 @@ video::ITexture* CNullDriver::loadTextureFromFile(io::IReadFile* file, const io:
|
|||
}
|
||||
|
||||
if (texture)
|
||||
os::Printer::log("Loaded texture", file->getFileName());
|
||||
os::Printer::log("Loaded texture", file->getFileName(), ELL_DEBUG);
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < imageArray.size(); ++i)
|
||||
|
|
|
@ -415,31 +415,10 @@ IAnimatedMesh* CSceneManager::getMesh(const io::path& filename, const io::path&
|
|||
return 0;
|
||||
}
|
||||
|
||||
// iterate the list in reverse order so user-added loaders can override the built-in ones
|
||||
s32 count = MeshLoaderList.size();
|
||||
for (s32 i=count-1; i>=0; --i)
|
||||
{
|
||||
if (MeshLoaderList[i]->isALoadableFileExtension(filename))
|
||||
{
|
||||
// reset file to avoid side effects of previous calls to createMesh
|
||||
file->seek(0);
|
||||
msh = MeshLoaderList[i]->createMesh(file);
|
||||
if (msh)
|
||||
{
|
||||
MeshCache->addMesh(cacheName, msh);
|
||||
msh->drop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
msh = getUncachedMesh(file, filename, cacheName);
|
||||
|
||||
file->drop();
|
||||
|
||||
if (!msh)
|
||||
os::Printer::log("Could not load mesh, file format seems to be unsupported", filename, ELL_ERROR);
|
||||
else
|
||||
os::Printer::log("Loaded mesh", filename, ELL_INFORMATION);
|
||||
|
||||
return msh;
|
||||
}
|
||||
|
||||
|
@ -451,22 +430,32 @@ IAnimatedMesh* CSceneManager::getMesh(io::IReadFile* file)
|
|||
return 0;
|
||||
|
||||
io::path name = file->getFileName();
|
||||
IAnimatedMesh* msh = MeshCache->getMeshByName(file->getFileName());
|
||||
IAnimatedMesh* msh = MeshCache->getMeshByName(name);
|
||||
if (msh)
|
||||
return msh;
|
||||
|
||||
msh = getUncachedMesh(file, name, name);
|
||||
|
||||
return msh;
|
||||
}
|
||||
|
||||
// load and create a mesh which we know already isn't in the cache and put it in there
|
||||
IAnimatedMesh* CSceneManager::getUncachedMesh(io::IReadFile* file, const io::path& filename, const io::path& cachename)
|
||||
{
|
||||
IAnimatedMesh* msh = 0;
|
||||
|
||||
// iterate the list in reverse order so user-added loaders can override the built-in ones
|
||||
s32 count = MeshLoaderList.size();
|
||||
for (s32 i=count-1; i>=0; --i)
|
||||
{
|
||||
if (MeshLoaderList[i]->isALoadableFileExtension(name))
|
||||
if (MeshLoaderList[i]->isALoadableFileExtension(filename))
|
||||
{
|
||||
// reset file to avoid side effects of previous calls to createMesh
|
||||
file->seek(0);
|
||||
msh = MeshLoaderList[i]->createMesh(file);
|
||||
if (msh)
|
||||
{
|
||||
MeshCache->addMesh(file->getFileName(), msh);
|
||||
MeshCache->addMesh(cachename, msh);
|
||||
msh->drop();
|
||||
break;
|
||||
}
|
||||
|
@ -474,14 +463,13 @@ IAnimatedMesh* CSceneManager::getMesh(io::IReadFile* file)
|
|||
}
|
||||
|
||||
if (!msh)
|
||||
os::Printer::log("Could not load mesh, file format seems to be unsupported", file->getFileName(), ELL_ERROR);
|
||||
os::Printer::log("Could not load mesh, file format seems to be unsupported", filename, ELL_ERROR);
|
||||
else
|
||||
os::Printer::log("Loaded mesh", file->getFileName(), ELL_INFORMATION);
|
||||
os::Printer::log("Loaded mesh", filename, ELL_DEBUG);
|
||||
|
||||
return msh;
|
||||
}
|
||||
|
||||
|
||||
//! returns the video driver
|
||||
video::IVideoDriver* CSceneManager::getVideoDriver()
|
||||
{
|
||||
|
@ -1377,6 +1365,16 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE
|
|||
return taken;
|
||||
}
|
||||
|
||||
void CSceneManager::clearAllRegisteredNodesForRendering()
|
||||
{
|
||||
CameraList.clear();
|
||||
LightList.clear();
|
||||
SkyBoxList.clear();
|
||||
SolidNodeList.clear();
|
||||
TransparentNodeList.clear();
|
||||
TransparentEffectNodeList.clear();
|
||||
ShadowNodeList.clear();
|
||||
}
|
||||
|
||||
//! This method is called just before the rendering process of the whole scene.
|
||||
//! draws all scene nodes
|
||||
|
|
|
@ -112,6 +112,9 @@ namespace scene
|
|||
//! registers a node for rendering it at a specific time.
|
||||
virtual u32 registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) _IRR_OVERRIDE_;
|
||||
|
||||
//! Clear all nodes which are currently registered for rendering
|
||||
virtual void clearAllRegisteredNodesForRendering() _IRR_OVERRIDE_;
|
||||
|
||||
//! draws all scene nodes
|
||||
virtual void drawAll() _IRR_OVERRIDE_;
|
||||
|
||||
|
@ -531,6 +534,9 @@ namespace scene
|
|||
|
||||
private:
|
||||
|
||||
// load and create a mesh which we know already isn't in the cache and put it in there
|
||||
IAnimatedMesh* getUncachedMesh(io::IReadFile* file, const io::path& filename, const io::path& cachename);
|
||||
|
||||
//! clears the deletion list
|
||||
void clearDeletionList();
|
||||
|
||||
|
|
Loading…
Reference in New Issue