working on colors issue

This commit is contained in:
2023-04-14 12:29:17 +02:00
parent 4fa9873f44
commit c497645ee9
11 changed files with 16 additions and 73 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2023/04/12 19:34:45 by maldavid ### ########.fr */
/* Updated: 2023/04/13 10:56:19 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -39,8 +39,8 @@ namespace mlx::core
inline void onEvent(void* win, int event, int (*funct_ptr)(int, void*), void* param) noexcept;
inline constexpr void enableAutoRepeat() noexcept;
inline constexpr void disableAutoRepeat() noexcept;
inline void enableAutoRepeat() noexcept;
inline void disableAutoRepeat() noexcept;
inline void getScreenSize(int* w, int* h) noexcept;

View File

@@ -32,12 +32,12 @@ namespace mlx::core
_in->onEvent(_graphics[*static_cast<int*>(win)]->getWindow()->getID(), event, funct_ptr, param);
}
constexpr void Application::enableAutoRepeat() noexcept
void Application::enableAutoRepeat() noexcept
{
_in->enableAutoRepeat();
}
constexpr void Application::disableAutoRepeat() noexcept
void Application::disableAutoRepeat() noexcept
{
_in->disableAutoRepeat();
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 16:27:35 by maldavid #+# #+# */
/* Updated: 2023/04/12 20:02:44 by maldavid ### ########.fr */
/* Updated: 2023/04/13 10:55:46 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/25 11:59:07 by maldavid #+# #+# */
/* Updated: 2023/04/11 16:21:23 by maldavid ### ########.fr */
/* Updated: 2023/04/13 15:07:01 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,21 +17,6 @@
namespace mlx
{
VkFormat findSupportedFormat(const std::vector<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
{
for(VkFormat format : candidates)
{
VkFormatProperties props;
vkGetPhysicalDeviceFormatProperties(Render_Core::get().getDevice().getPhysicalDevice(), format, &props);
if(tiling == VK_IMAGE_TILING_LINEAR && (props.linearTilingFeatures & features) == features)
return format;
else if(tiling == VK_IMAGE_TILING_OPTIMAL && (props.optimalTilingFeatures & features) == features)
return format;
}
core::error::report(e_kind::fatal_error, "Vulkan : failed to find image format");
return VK_FORMAT_R8G8B8A8_UNORM; // to avoid warning;
}
void Image::create(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties)
{
_width = width;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/25 11:54:21 by maldavid #+# #+# */
/* Updated: 2023/04/08 18:41:26 by maldavid ### ########.fr */
/* Updated: 2023/04/13 10:59:04 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,6 @@
namespace mlx
{
VkFormat findSupportedFormat(const std::vector<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features);
uint32_t formatSize(VkFormat format);
class Image

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/18 21:27:38 by maldavid #+# #+# */
/* Updated: 2023/04/01 15:21:00 by maldavid ### ########.fr */
/* Updated: 2023/04/13 14:52:57 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -24,7 +24,7 @@ namespace mlx
layout(location = 1) in vec4 aColor;
layout(location = 2) in vec2 aUV;
layout(set=0, binding=0) uniform uProjection {
layout(set = 0, binding = 0) uniform uProjection {
mat4 mat;
} uProj;
@@ -109,7 +109,7 @@ namespace mlx
layout(location = 0) out vec4 fColor;
layout(set=1, binding=0) uniform sampler2D sTexture;
layout(set = 1, binding = 0) uniform sampler2D sTexture;
layout(location = 0) in struct {
vec4 Color;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/31 15:14:50 by maldavid #+# #+# */
/* Updated: 2023/04/05 00:28:29 by maldavid ### ########.fr */
/* Updated: 2023/04/13 14:51:37 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -37,7 +37,7 @@ namespace mlx
if(!_buffer.isMapped())
_buffer.mapMem(&_map);
unsigned char* mem = static_cast<unsigned char*>(_map) + (y * _width * sizeof(uint32_t)) + (x * sizeof(uint32_t));
int new_color = color & 0xFFFFFF00;
uint32_t new_color = color & 0xFFFFFF00;
new_color >>= 8;
new_color |= (color << 24) & 0xFF000000;
*reinterpret_cast<uint32_t*>(mem) = new_color;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */
/* Updated: 2023/04/12 13:21:42 by maldavid ### ########.fr */
/* Updated: 2023/04/13 10:49:04 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */