[olympic,nostalgia] Cleanup some reinterpret_casts
This commit is contained in:
parent
3a781f6704
commit
13ddbd981e
@ -193,11 +193,11 @@ static void initSpritesBufferset(GLuint shader, glutils::BufferSet &bs) noexcept
|
|||||||
auto const posAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vPosition"));
|
auto const posAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vPosition"));
|
||||||
glEnableVertexAttribArray(posAttr);
|
glEnableVertexAttribArray(posAttr);
|
||||||
glVertexAttribPointer(posAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float),
|
glVertexAttribPointer(posAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(1 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{1 * sizeof(float)}));
|
||||||
auto const texCoordAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vTexCoord"));
|
auto const texCoordAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vTexCoord"));
|
||||||
glEnableVertexAttribArray(texCoordAttr);
|
glEnableVertexAttribArray(texCoordAttr);
|
||||||
glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float),
|
glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(3 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{3 * sizeof(float)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initBackgroundBufferset(
|
static void initBackgroundBufferset(
|
||||||
@ -220,12 +220,12 @@ static void initBackgroundBufferset(
|
|||||||
glEnableVertexAttribArray(texCoordAttr);
|
glEnableVertexAttribArray(texCoordAttr);
|
||||||
glVertexAttribPointer(
|
glVertexAttribPointer(
|
||||||
texCoordAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float),
|
texCoordAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(2 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{2 * sizeof(float)}));
|
||||||
auto const heightMultAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vTileIdx"));
|
auto const heightMultAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vTileIdx"));
|
||||||
glEnableVertexAttribArray(heightMultAttr);
|
glEnableVertexAttribArray(heightMultAttr);
|
||||||
glVertexAttribPointer(
|
glVertexAttribPointer(
|
||||||
heightMultAttr, 1, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float),
|
heightMultAttr, 1, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(4 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{4 * sizeof(float)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
static glutils::GLTexture createTexture(
|
static glutils::GLTexture createTexture(
|
||||||
|
@ -50,11 +50,11 @@ void TileSheetGrid::initBufferSet(ox::Vec2 const&paneSize, TileSheet::SubSheet c
|
|||||||
const auto pt2Attr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPt2"));
|
const auto pt2Attr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPt2"));
|
||||||
glEnableVertexAttribArray(pt2Attr);
|
glEnableVertexAttribArray(pt2Attr);
|
||||||
glVertexAttribPointer(pt2Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
glVertexAttribPointer(pt2Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(2 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{2 * sizeof(float)}));
|
||||||
const auto colorAttr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vColor"));
|
const auto colorAttr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vColor"));
|
||||||
glEnableVertexAttribArray(colorAttr);
|
glEnableVertexAttribArray(colorAttr);
|
||||||
glVertexAttribPointer(colorAttr, 3, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
glVertexAttribPointer(colorAttr, 3, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(4 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{4 * sizeof(float)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetGrid::update(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept {
|
void TileSheetGrid::update(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept {
|
||||||
|
@ -47,7 +47,7 @@ void TileSheetPixels::initBufferSet(ox::Vec2 const&paneSize) noexcept {
|
|||||||
const auto colorAttr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vColor"));
|
const auto colorAttr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vColor"));
|
||||||
glEnableVertexAttribArray(colorAttr);
|
glEnableVertexAttribArray(colorAttr);
|
||||||
glVertexAttribPointer(colorAttr, 3, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
glVertexAttribPointer(colorAttr, 3, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
||||||
reinterpret_cast<void*>(2 * sizeof(float)));
|
std::bit_cast<void*>(uintptr_t{2 * sizeof(float)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetPixels::update(ox::Vec2 const&paneSize) noexcept {
|
void TileSheetPixels::update(ox::Vec2 const&paneSize) noexcept {
|
||||||
|
@ -81,7 +81,7 @@ ox::Result<keel::AssetRef<T>> readObjNoCache(
|
|||||||
ox::CRStringView assetId) noexcept {
|
ox::CRStringView assetId) noexcept {
|
||||||
if constexpr(ox::preloadable<T>::value) {
|
if constexpr(ox::preloadable<T>::value) {
|
||||||
oxRequire(addr, getPreloadAddr(ctx, assetId));
|
oxRequire(addr, getPreloadAddr(ctx, assetId));
|
||||||
return keel::AssetRef<T>(reinterpret_cast<const T*>(addr));
|
return keel::AssetRef<T>(std::bit_cast<const T*>(uintptr_t{addr}));
|
||||||
} else {
|
} else {
|
||||||
return OxError(1);
|
return OxError(1);
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ ox::Result<keel::AssetRef<T>> readObj(
|
|||||||
#else
|
#else
|
||||||
if constexpr(ox::preloadable<T>::value) {
|
if constexpr(ox::preloadable<T>::value) {
|
||||||
oxRequire(addr, getPreloadAddr(ctx, file));
|
oxRequire(addr, getPreloadAddr(ctx, file));
|
||||||
return keel::AssetRef<T>(reinterpret_cast<const T*>(addr));
|
return keel::AssetRef<T>(std::bit_cast<const T*>(uintptr_t{addr}));
|
||||||
} else {
|
} else {
|
||||||
return OxError(1);
|
return OxError(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user