mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (MG_State/RenderbufferObject): Better RenderbufferObject.
This commit is contained in:
@@ -1,17 +1,11 @@
|
|||||||
#include "RenderbufferObject.h"
|
#include "RenderbufferObject.h"
|
||||||
|
#include <MG_Util/Metrics/TextureMetrics.h>
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
namespace MG_State {
|
namespace MG_State {
|
||||||
namespace GLState {
|
namespace GLState {
|
||||||
RenderbufferObject::RenderbufferObject(Uint externalIndex) : m_externalIndex(externalIndex) {}
|
RenderbufferObject::RenderbufferObject(Uint externalIndex) : m_externalIndex(externalIndex) {}
|
||||||
|
|
||||||
void RenderbufferObject::Storage(Int internalFormat, Int width, Int height) {
|
|
||||||
m_internalFormat = internalFormat;
|
|
||||||
m_width = width;
|
|
||||||
m_height = height;
|
|
||||||
m_allocated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Int RenderbufferObject::GetWidth() const {
|
Int RenderbufferObject::GetWidth() const {
|
||||||
return m_width;
|
return m_width;
|
||||||
}
|
}
|
||||||
@@ -20,13 +14,52 @@ namespace MobileGL {
|
|||||||
return m_height;
|
return m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Int RenderbufferObject::GetInternalFormat() const {
|
TextureInternalFormat RenderbufferObject::GetInternalFormat() const {
|
||||||
return m_internalFormat;
|
return m_internalFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool RenderbufferObject::IsAllocated() const {
|
Bool RenderbufferObject::IsAllocated() const {
|
||||||
return m_allocated;
|
return m_allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Int RenderbufferObject::GetRedSize() const {
|
||||||
|
return m_componentSizes.Red;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int RenderbufferObject::GetGreenSize() const {
|
||||||
|
return m_componentSizes.Green;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int RenderbufferObject::GetBlueSize() const {
|
||||||
|
return m_componentSizes.Blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int RenderbufferObject::GetAlphaSize() const {
|
||||||
|
return m_componentSizes.Alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int RenderbufferObject::GetDepthSize() const {
|
||||||
|
return m_componentSizes.Depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int RenderbufferObject::GetStencilSize() const {
|
||||||
|
return m_componentSizes.Stencil;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ComponentSizes& RenderbufferObject::GetComponentSizes() const {
|
||||||
|
return m_componentSizes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderbufferObject::SetInternalFormat(TextureInternalFormat format) {
|
||||||
|
m_internalFormat = format;
|
||||||
|
m_componentSizes = MG_Util::GetComponentSizesForInternalFormat(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderbufferObject::AllocateStorage(IntVec2 size) {
|
||||||
|
m_width = size.x();
|
||||||
|
m_height = size.y();
|
||||||
|
m_allocated = true;
|
||||||
|
}
|
||||||
} // namespace GLState
|
} // namespace GLState
|
||||||
} // namespace MG_State
|
} // namespace MG_State
|
||||||
} // namespace MobileGL
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Includes.h>
|
#include <Includes.h>
|
||||||
|
#include <MG_Util/Math/VectorTypes.h>
|
||||||
|
#include <MG_State/GLState/TextureState/TextureEnum.h>
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
enum class RenderbufferTarget { // fucky stuff in GL spec
|
enum class RenderbufferTarget {
|
||||||
Renderbuffer,
|
Renderbuffer,
|
||||||
RenderbufferTargetCount,
|
RenderbufferTargetCount,
|
||||||
Unknown = -1
|
Unknown = -1
|
||||||
@@ -16,18 +18,29 @@ namespace MobileGL {
|
|||||||
|
|
||||||
RenderbufferObject(Uint externalIndex);
|
RenderbufferObject(Uint externalIndex);
|
||||||
|
|
||||||
void Storage(Int internalFormat, Int width, Int height);
|
void SetInternalFormat(TextureInternalFormat format);
|
||||||
|
void AllocateStorage(IntVec2 size);
|
||||||
Int GetWidth() const;
|
Int GetWidth() const;
|
||||||
Int GetHeight() const;
|
Int GetHeight() const;
|
||||||
Int GetInternalFormat() const;
|
TextureInternalFormat GetInternalFormat() const;
|
||||||
Bool IsAllocated() const;
|
Bool IsAllocated() const;
|
||||||
|
const ComponentSizes& GetComponentSizes() const;
|
||||||
|
Int GetRedSize() const;
|
||||||
|
Int GetGreenSize() const;
|
||||||
|
Int GetBlueSize() const;
|
||||||
|
Int GetAlphaSize() const;
|
||||||
|
Int GetDepthSize() const;
|
||||||
|
Int GetStencilSize() const;
|
||||||
|
Int GetSamples() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Uint m_externalIndex = 0;
|
Uint m_externalIndex = 0;
|
||||||
Int m_internalFormat = 0;
|
TextureInternalFormat m_internalFormat;
|
||||||
Int m_width = 0;
|
Int m_width = 0;
|
||||||
Int m_height = 0;
|
Int m_height = 0;
|
||||||
|
Int m_samples = 0; // TODO: multisampling support
|
||||||
Bool m_allocated = false;
|
Bool m_allocated = false;
|
||||||
|
ComponentSizes m_componentSizes;
|
||||||
};
|
};
|
||||||
} // namespace GLState
|
} // namespace GLState
|
||||||
} // namespace MG_State
|
} // namespace MG_State
|
||||||
|
|||||||
Reference in New Issue
Block a user