Merged revisions 2072:2087 from 1.5 branch. Some missing inits fixed, OpenGL FBO fails better recognizeable, docs updated.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2088 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-01-18 22:39:03 +00:00
parent accdcfa76d
commit 0cb7f45018
6 changed files with 32 additions and 20 deletions

View File

@ -513,6 +513,10 @@ namespace scene
/** This camera does not react on user input like for example the one created with
addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the
ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods.
By default, a camera's look at position (set with setTarget()) and its scene node
rotation (set with setRotation()) are independent. If you want to be able to
control the direction that the camera looks by using setRotation() then call
ICameraSceneNode::bindTargetAndRotation(true) on it.
\param position: Position of the space relative to its parent where the camera will be placed.
\param lookat: Position where the camera will look at. Also known as target.
\param parent: Parent scene node of the camera. Can be null. If the parent moves,
@ -1033,7 +1037,7 @@ namespace scene
//! Creates a fly circle animator, which lets the attached scene node fly around a center.
/** \param center: Center of the circle.
\param radius: Radius of the circle.
\param speed: Specifies the speed of the flight.
\param speed: The orbital speed, in radians per millisecond.
\param direction: Specifies the upvector used for alignment of the mesh.
\return The animator. Attach it to a scene node with ISceneNode::addAnimator()
and the animator will animate it.

View File

@ -33,13 +33,11 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi
const core::rect<s32>& rectangle)
: IGUIEditBox(environment, parent, id, rectangle), MouseMarking(false),
Border(border), OverrideColorEnabled(false), MarkBegin(0), MarkEnd(0),
OverrideColor(video::SColor(101,255,255,255)),
OverrideFont(0), LastBreakFont(0), CursorPos(0), HScrollPos(0), VScrollPos(0), Max(0),
OverrideColor(video::SColor(101,255,255,255)), OverrideFont(0), LastBreakFont(0),
Operator(0), BlinkStartTime(0), CursorPos(0), HScrollPos(0), VScrollPos(0), Max(0),
WordWrap(false), MultiLine(false), AutoScroll(true), PasswordBox(false),
PasswordChar(L'*'),
HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER),
PasswordChar(L'*'), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER),
CurrentTextRect(0,0,1,1), FrameRect(rectangle)
{
#ifdef _DEBUG
setDebugName("CGUIEditBox");
@ -47,7 +45,8 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi
Text = text;
Operator = environment->getOSOperator();
if (Environment)
Operator = Environment->getOSOperator();
if (Operator)
Operator->grab();
@ -56,7 +55,9 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi
setTabStop(true);
setTabOrder(-1);
IGUISkin *skin = Environment->getSkin();
IGUISkin *skin = 0;
if (Environment)
skin = Environment->getSkin();
if (Border && skin)
{
FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1;

View File

@ -39,7 +39,7 @@ bool CImageLoaderPPM::isALoadableFileExtension(const c8* fileName) const
//! returns true if the file maybe is able to be loaded by this class
bool CImageLoaderPPM::isALoadableFileFormat(io::IReadFile* file) const
{
c8 id[2];
c8 id[2]={0};
file->read(&id, 2);
return (id[0]=='P' && id[1]>'0' && id[1]<'7');
}

View File

@ -2806,14 +2806,20 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<s32>& si
rtt = new COpenGLFBOTexture(size, name, this);
if (rtt)
{
bool success = false;
addTexture(rtt);
ITexture* tex = createDepthTexture(rtt);
if (tex)
{
static_cast<video::COpenGLFBODepthTexture*>(tex)->attach(rtt);
success = static_cast<video::COpenGLFBODepthTexture*>(tex)->attach(rtt);
tex->drop();
}
rtt->drop();
if (!success)
{
removeTexture(rtt);
rtt=0;
}
}
}
else

View File

@ -433,11 +433,8 @@ void COpenGLTexture::unbindRTT()
/* FBO Textures */
#ifdef GL_EXT_framebuffer_object
// helper function for render to texture
static bool checkFBOStatus(COpenGLDriver* Driver);
#endif
//! RTT ColorFrameBuffer constructor
COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d<s32>& size,
@ -605,10 +602,10 @@ COpenGLFBODepthTexture::~COpenGLFBODepthTexture()
//combine depth texture and rtt
void COpenGLFBODepthTexture::attach(ITexture* renderTex)
bool COpenGLFBODepthTexture::attach(ITexture* renderTex)
{
if (!renderTex)
return;
return false;
video::COpenGLFBOTexture* rtt = static_cast<video::COpenGLFBOTexture*>(renderTex);
rtt->bindRTT();
#ifdef GL_EXT_framebuffer_object
@ -636,13 +633,17 @@ void COpenGLFBODepthTexture::attach(ITexture* renderTex)
GL_RENDERBUFFER_EXT,
DepthRenderBuffer);
}
#endif
// check the status
if (!checkFBOStatus(Driver))
{
os::Printer::log("FBO incomplete");
#endif
return false;
}
rtt->DepthTexture=this;
grab(); // grab the depth buffer, not the RTT
rtt->unbindRTT();
return true;
}
@ -658,9 +659,9 @@ void COpenGLFBODepthTexture::unbindRTT()
}
#ifdef GL_EXT_framebuffer_object
bool checkFBOStatus(COpenGLDriver* Driver)
{
#ifdef GL_EXT_framebuffer_object
GLenum status = Driver->extGlCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
switch (status)
@ -707,10 +708,10 @@ bool checkFBOStatus(COpenGLDriver* Driver)
default:
break;
}
#endif
os::Printer::log("FBO error", ELL_ERROR);
return false;
}
#endif
} // end namespace video

View File

@ -175,7 +175,7 @@ public:
//! Unbind RenderTargetTexture
virtual void unbindRTT();
void attach(ITexture*);
bool attach(ITexture*);
protected:
GLuint DepthRenderBuffer;