Public Member Functions | |
META_Node (osgPPU, UnitInMipmapOut) | |
UnitInMipmapOut () | |
Create default ppfx. | |
UnitInMipmapOut (const UnitInMipmapOut &, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
virtual | ~UnitInMipmapOut () |
Release it and used memory. | |
virtual void | init () |
void | generateMipmapForInputTexture (int index) |
int | getGenerateMipmapForInputTextureIndex () const |
void | setUseShader (bool use) |
bool | getUseShader () const |
Protected Member Functions | |
void | enableMipmapGeneration () |
bool | noticeBeginRendering (osg::RenderInfo &, const osg::Drawable *) |
void | noticeFinishRendering (osg::RenderInfo &renderInfo, const osg::Drawable *drawable) |
void | createAndAttachFBOs (osg::Texture *output, int mrt) |
Protected Attributes | |
std::vector< osg::ref_ptr < osg::FrameBufferObject > > | mMipmapFBO |
std::vector< osg::ref_ptr < osg::Viewport > > | mMipmapViewport |
std::vector< osg::ref_ptr < osg::Drawable > > | mMipmapDrawable |
osg::ref_ptr< osg::RefMatrix > | mProjectionMatrix |
osg::ref_ptr< osg::RefMatrix > | mModelviewMatrix |
int | mNumLevels |
int | mGenerateMipmapInputIndex |
bool | mUseShader |
int | mOutputWidth |
int | mOutputHeight |
UnitInMipmapOut do generate mipmap levels of an output texture by applying the shader to the input data. To generate the mipmapped output the input texture has to be reused. Therefore the output texture will be applied as an input texture. If input textures are already exists the output texture will be applied to the next free slot. Use this Unit to generate mipmaps of an input texture. The shader has to be able to generate correct mipmap levels out of the input data and/or previous levels.
You can also setup this unit in that way, that it do generate the mipmaps for the input texture and hence do not use any other output texture, which of course save some memory.
virtual void osgPPU::UnitInMipmapOut::init | ( | ) | [virtual] |
Initialize the UnitInMipmapOut. This will check if the unit is marked as dirty and will therefor setup the input and output texture properly.
Reimplemented from osgPPU::UnitInOut.
void osgPPU::UnitInMipmapOut::generateMipmapForInputTexture | ( | int | index | ) |
Specify the index of the input texture for which the mipmaps should be generated. Set to -1 if you would like to create an independent output texture in which the input texture incl. mipmaps will be stored.
int osgPPU::UnitInMipmapOut::getGenerateMipmapForInputTextureIndex | ( | ) | const |
Get index of an input texture for which the mipmaps are generated. If returns -1 then the output texture is unequal input texture.
void osgPPU::UnitInMipmapOut::setUseShader | ( | bool | use | ) |
Enable or disable the shader for the mipmap generation. If the shader is disabled then the glGenerateMipmapEXT function will be used to generate the mipmaps. Otehrwise the shader is used.
bool osgPPU::UnitInMipmapOut::getUseShader | ( | ) | const |
Get a flag if a shader is used to generate mipmaps. If returns false, then the hardware mipmap generation is enabled.
bool osgPPU::UnitInMipmapOut::noticeBeginRendering | ( | osg::RenderInfo & | , | |
const osg::Drawable * | ||||
) | [protected, virtual] |
Here the FBO will be applied, so that Unit can render its output to attached textures. If you overwrite this method in derived class, so you have to take care about FBO handling.
Reimplemented from osgPPU::UnitInOut.
void osgPPU::UnitInMipmapOut::noticeFinishRendering | ( | osg::RenderInfo & | , | |
const osg::Drawable * | ||||
) | [protected, virtual] |
Drawing is complete. So in our case, we will unbind used FBO and reset it to previous state Derived methods has to take care about correct handling of FBOs!
Reimplemented from osgPPU::UnitInOut.
Copyright (C) 2008 by Art Tevs (LGPL)