Browse Source

Using fixed-size 8bit integer for color attachment IDs.

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
246f08c4f1
  1. 2
      src/Framebuffer.cpp
  2. 14
      src/Framebuffer.h
  3. 1
      src/Physics/ShapedObjectGroup.h
  4. 2
      src/Trade/AbstractImporter.h

2
src/Framebuffer.cpp

@ -31,7 +31,7 @@ void Framebuffer::mapDefaultForDraw(std::initializer_list<DefaultDrawAttachment>
delete[] _attachments; delete[] _attachments;
} }
void Framebuffer::mapForDraw(std::initializer_list<int> colorAttachments) { void Framebuffer::mapForDraw(std::initializer_list<std::int8_t> colorAttachments) {
GLenum* attachments = new GLenum[colorAttachments.size()]; GLenum* attachments = new GLenum[colorAttachments.size()];
for(auto it = colorAttachments.begin(); it != colorAttachments.end(); ++it) for(auto it = colorAttachments.begin(); it != colorAttachments.end(); ++it)
attachments[it-colorAttachments.begin()] = *it + GL_COLOR_ATTACHMENT0; attachments[it-colorAttachments.begin()] = *it + GL_COLOR_ATTACHMENT0;

14
src/Framebuffer.h

@ -819,7 +819,7 @@ class MAGNUM_EXPORT Framebuffer {
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
void mapForDraw(std::initializer_list<int> colorAttachments); void mapForDraw(std::initializer_list<std::int8_t> colorAttachments);
/** /**
* @brief Map given attachment of default framebuffer for reading * @brief Map given attachment of default framebuffer for reading
@ -846,7 +846,7 @@ class MAGNUM_EXPORT Framebuffer {
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void mapForRead(unsigned int colorAttachment) { inline void mapForRead(std::uint8_t colorAttachment) {
bind(Target::Read); bind(Target::Read);
glReadBuffer(GL_COLOR_ATTACHMENT0 + colorAttachment); glReadBuffer(GL_COLOR_ATTACHMENT0 + colorAttachment);
} }
@ -904,7 +904,7 @@ class MAGNUM_EXPORT Framebuffer {
* @see bind(), @fn_gl{FramebufferRenderbuffer} * @see bind(), @fn_gl{FramebufferRenderbuffer}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachRenderbuffer(Target target, unsigned int colorAttachment, Renderbuffer* renderbuffer) { inline void attachRenderbuffer(Target target, std::uint8_t colorAttachment, Renderbuffer* renderbuffer) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
bind(target); bind(target);
glFramebufferRenderbuffer(static_cast<GLenum>(target), GL_COLOR_ATTACHMENT0 + colorAttachment, GL_RENDERBUFFER, renderbuffer->id()); glFramebufferRenderbuffer(static_cast<GLenum>(target), GL_COLOR_ATTACHMENT0 + colorAttachment, GL_RENDERBUFFER, renderbuffer->id());
@ -940,7 +940,7 @@ class MAGNUM_EXPORT Framebuffer {
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachTexture1D(Target target, unsigned int colorAttachment, Texture1D* texture, GLint mipLevel) { inline void attachTexture1D(Target target, std::uint8_t colorAttachment, Texture1D* texture, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
/** @todo Check for texture target compatibility */ /** @todo Check for texture target compatibility */
bind(target); bind(target);
@ -977,7 +977,7 @@ class MAGNUM_EXPORT Framebuffer {
* @see attachCubeMapTexture(), bind(), @fn_gl{FramebufferTexture} * @see attachCubeMapTexture(), bind(), @fn_gl{FramebufferTexture}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachTexture2D(Target target, unsigned int colorAttachment, Texture2D* texture, GLint mipLevel) { inline void attachTexture2D(Target target, std::uint8_t colorAttachment, Texture2D* texture, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
/** @todo Check for texture target compatibility */ /** @todo Check for texture target compatibility */
bind(target); bind(target);
@ -1012,7 +1012,7 @@ class MAGNUM_EXPORT Framebuffer {
* @see attachTexture2D(), bind(), @fn_gl{FramebufferTexture} * @see attachTexture2D(), bind(), @fn_gl{FramebufferTexture}
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachCubeMapTexture(Target target, unsigned int colorAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) { inline void attachCubeMapTexture(Target target, std::uint8_t colorAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
bind(target); bind(target);
glFramebufferTexture2D(static_cast<GLenum>(target), GL_COLOR_ATTACHMENT0 + colorAttachment, static_cast<GLenum>(coordinate), texture->id(), mipLevel); glFramebufferTexture2D(static_cast<GLenum>(target), GL_COLOR_ATTACHMENT0 + colorAttachment, static_cast<GLenum>(coordinate), texture->id(), mipLevel);
@ -1050,7 +1050,7 @@ class MAGNUM_EXPORT Framebuffer {
* @requires_gl * @requires_gl
* @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gl30 Extension @extension{EXT,framebuffer_object}
*/ */
inline void attachTexture3D(Target target, unsigned int colorAttachment, Texture3D* texture, GLint mipLevel, GLint layer) { inline void attachTexture3D(Target target, std::uint8_t colorAttachment, Texture3D* texture, GLint mipLevel, GLint layer) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
/** @todo Check for texture target compatibility */ /** @todo Check for texture target compatibility */
bind(target); bind(target);

1
src/Physics/ShapedObjectGroup.h

@ -19,7 +19,6 @@
* @brief Class Magnum::Physics::ShapedObjectGroup * @brief Class Magnum::Physics::ShapedObjectGroup
*/ */
#include <cstddef>
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>

2
src/Trade/AbstractImporter.h

@ -28,7 +28,7 @@ namespace Magnum { namespace Trade {
class AbstractMaterialData; class AbstractMaterialData;
class CameraData; class CameraData;
template<size_t> class ImageData; template<std::uint8_t> class ImageData;
class LightData; class LightData;
class MeshData2D; class MeshData2D;
class MeshData3D; class MeshData3D;

Loading…
Cancel
Save