Merge branch 'master' into text_improvements

This commit is contained in:
Robert Osfield
2017-10-20 14:14:14 +01:00
25 changed files with 622 additions and 138 deletions

View File

@@ -17,6 +17,7 @@
#include <osg/BufferObject>
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec3i>
#include <osg/Vec4>
#include <osg/FrameStamp>
#include <osg/StateAttribute>
@@ -118,6 +119,38 @@
#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
#endif
#ifndef GL_KHR_texture_compression_astc_hdr
#define GL_KHR_texture_compression_astc_hdr 1
#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
#endif /* GL_KHR_texture_compression_astc_hdr */
#ifndef GL_DEPTH_COMPONENT
#define GL_DEPTH_COMPONENT 0x1902
#endif
@@ -408,11 +441,17 @@ class OSG_EXPORT Image : public BufferData
static bool isPackedType(GLenum type);
static GLenum computePixelFormat(GLenum pixelFormat);
static GLenum computeFormatDataType(GLenum pixelFormat);
/** return the dimensions of a block of compressed pixels */
static osg::Vec3i computeBlockFootprint(GLenum pixelFormat);
/** return the size in bytes of a block of compressed pixels */
static unsigned int computeBlockSize(GLenum pixelFormat, GLenum packing);
static unsigned int computeNumComponents(GLenum pixelFormat);
static unsigned int computePixelSizeInBits(GLenum pixelFormat,GLenum type);
static unsigned int computeRowWidthInBytes(int width,GLenum pixelFormat,GLenum type,int packing);
static unsigned int computeImageSizeInBytes(int width,int height, int depth, GLenum pixelFormat, GLenum type, int packing = 1, int slice_packing = 1, int image_packing = 1);
static int roudUpToMultiple(int s, int pack);
static int computeNearestPowerOfTwo(int s,float bias=0.5f);
static int computeNumberOfMipmapLevels(int s,int t = 1, int r = 1);

View File

@@ -168,8 +168,8 @@ public:
}
/// get command array of this indirect primitive set
inline IndirectCommandDrawElements* getIndirectCommandArray() { return _indirectCommandArray; }
inline const IndirectCommandDrawElements* getIndirectCommandArray() const { return _indirectCommandArray; }
inline IndirectCommandDrawElements* getIndirectCommandArray() { return _indirectCommandArray.get(); }
inline const IndirectCommandDrawElements* getIndirectCommandArray() const { return _indirectCommandArray.get(); }
///Further methods are for advanced DI when you plan to use your own IndirectCommandElement (stride)
///or if you want to draw a particular command index of the IndirectCommandElement(FirstCommandToDraw)
@@ -616,8 +616,8 @@ public:
if(!dynamic_cast<DrawIndirectBufferObject* >(_indirectCommandArray->getBufferObject()))
_indirectCommandArray->setBufferObject(new DrawIndirectBufferObject());
}
inline const IndirectCommandDrawArrays* getIndirectCommandArray() const { return _indirectCommandArray; }
inline IndirectCommandDrawArrays* getIndirectCommandArray() { return _indirectCommandArray; }
inline const IndirectCommandDrawArrays* getIndirectCommandArray() const { return _indirectCommandArray.get(); }
inline IndirectCommandDrawArrays* getIndirectCommandArray() { return _indirectCommandArray.get(); }
protected:

View File

@@ -55,7 +55,7 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
memset(_keyMap, 0, 32);
init();
if (valid())
{
setState( new osg::State );
@@ -73,7 +73,7 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
}
}
virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindowX11*>(object)!=0; }
virtual const char* libraryName() const { return "osgViewer"; }
virtual const char* className() const { return "GraphicsWindowX11"; }
@@ -130,35 +130,35 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
{
WindowData(Window window):
_window(window) {}
Window _window;
};
public:
// X11 specific access functions
Display* getEventDisplay() const { return _eventDisplay; }
Display* getDisplayToUse() const ;
Window& getParent() { return _parent; }
Window& getWindow() { return _window; }
Cursor getCurrentCursor() { return _currentCursor; }
protected:
~GraphicsWindowX11();
Cursor getOrCreateCursor(MouseCursor mouseShape);
bool createVisualInfo();
bool createWindow();
bool setWindow(Window window);
void init();
bool checkAndSendEventFullScreenIfNeeded(Display* display, int x, int y, int width, int height, bool windowDecoration);
@@ -172,7 +172,7 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
int getModifierMask() const;
void syncLocks();
void flushKeyEvents();
bool _valid;
Display* _eventDisplay;
Window _parent;
@@ -189,7 +189,7 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow, pub
Cursor _currentCursor;
Atom _deleteWindow;
bool _initialized;
bool _realized;
bool _ownsWindow;