/usr/include/Inventor/misc/SoGLImage.h is in libcoin80-dev 3.1.4~abc9f50-4ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | #ifndef COIN_SOGLIMAGE_H
#define COIN_SOGLIMAGE_H
/**************************************************************************\
* Copyright (c) Kongsberg Oil & Gas Technologies AS
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/
// WARNING: This is work in progress. Do not expect this class to have
// a stable interface over a long period of time. It is installed
// because we need it in an internal project.
// FIXME: make sure we do a design review for this class for Coin v3.0
// pederb, 2001-11-28
#include <Inventor/SbBasic.h>
#include <Inventor/SbVec2s.h>
#include <Inventor/SbVec3s.h>
#include <Inventor/SoType.h>
#include <stddef.h>
class SoGLDisplayList;
class SoState;
class SbImage;
class COIN_DLL_API SoGLImage {
public:
SoGLImage();
virtual void unref(SoState * state = NULL);
static SoType getClassTypeId(void);
virtual SoType getTypeId(void) const ;
virtual SbBool isOfType(SoType type) const;
enum Wrap {
REPEAT = 0,
CLAMP,
CLAMP_TO_EDGE,
CLAMP_TO_BORDER
};
enum ResizeReason {
IMAGE = 0,
SUBIMAGE,
MIPMAP
};
typedef SbBool SoGLImageResizeCB(SoState * state,
const SbVec3s &newsize,
unsigned char * destbuffer,
ResizeReason reason,
void * closure,
class SoGLImage * image);
void setGLDisplayList(SoGLDisplayList * dl,
SoState * state,
const Wrap wraps = REPEAT,
const Wrap wrapt = REPEAT,
const float quality = 0.5f);
void setPBuffer(SoState * state,
void * context,
const Wrap wraps = REPEAT,
const Wrap wrapt = REPEAT,
const float quality = 0.5f);
void setData(const unsigned char * bytes,
const SbVec2s & size,
const int numcomponents,
const Wrap wraps = REPEAT,
const Wrap wrapt = REPEAT,
const float quality = 0.5f,
const int border = 0,
SoState * createinstate = NULL);
void setData(const unsigned char * bytes,
const SbVec3s & size,
const int numcomponents,
const Wrap wraps = REPEAT,
const Wrap wrapt = REPEAT,
const Wrap wrapr = REPEAT,
const float quality = 0.5f,
const int border = 0,
SoState * createinstate = NULL);
virtual void setData(const SbImage * image,
const Wrap wraps = REPEAT,
const Wrap wrapt = REPEAT,
const float quality = 0.5f,
const int border = 0,
SoState * createinstate = NULL);
virtual void setData(const SbImage * image,
const Wrap wraps,
const Wrap wrapt,
const Wrap wrapr,
const float quality = 0.5f,
const int border = 0,
SoState * createinstate = NULL);
// these flags can be used to set texture properties.
enum Flags {
// mipmap, scaling and filtering settings
SCALE_DOWN = 0x0001,
NO_MIPMAP = 0x0002,
LINEAR_MAG_FILTER = 0x0004,
LINEAR_MIN_FILTER = 0x0008,
LINEAR_MIPMAP_FILTER = 0x0010,
// use if you know your image properties.
FORCE_TRANSPARENCY_TRUE = 0x0020,
FORCE_TRANSPARENCY_FALSE = 0x0040,
FORCE_ALPHA_TEST_TRUE = 0x0080,
FORCE_ALPHA_TEST_FALSE = 0x0100,
INVINCIBLE = 0x0200, // never die of old age
// use GL_NV_texture_rectangle or GL_EXT_texture_rectangle
RECTANGLE = 0x0400,
// Compress texture if available from OpenGL
COMPRESSED = 0x0800,
// use quality value to decide mipmap, filtering and scaling. This
// is the default.
USE_QUALITY_VALUE = 0X8000
};
void setFlags(const uint32_t flags);
uint32_t getFlags(void) const;
const SbImage * getImage(void) const;
virtual SoGLDisplayList * getGLDisplayList(SoState * state);
SbBool hasTransparency(void) const;
SbBool useAlphaTest(void) const;
Wrap getWrapS(void) const;
Wrap getWrapT(void) const;
Wrap getWrapR(void) const;
float getQuality(void) const;
uint32_t getGLImageId(void) const;
protected:
void incAge(void) const;
void resetAge(void) const;
virtual void unrefOldDL(SoState * state, const uint32_t maxage);
virtual ~SoGLImage();
private:
class SoGLImageP * pimpl;
friend class SoGLImageP;
static void cleanupClass(void);
public:
// internal methods for texture resource management
static void beginFrame(SoState * state);
static void tagImage(SoState * state, SoGLImage * image);
static void endFrame(SoState * state);
static void setDisplayListMaxAge(const uint32_t maxage);
static void freeAllImages(SoState * state = NULL);
void setEndFrameCallback(void (*cb)(void *), void * closure);
int getNumFramesSinceUsed(void) const;
public:
static void initClass(void);
static void setResizeCallback(SoGLImageResizeCB * f, void * closure);
private:
static void registerImage(SoGLImage * image);
static void unregisterImage(SoGLImage * image);
};
#endif // !COIN_SOGLIMAGE_H
|