Core/Color: Switch formal from RGBA8 to RGBA32F
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
const Color Color::Black(0, 0, 0);
|
||||
const Color Color::Blue(0, 0, 255);
|
||||
const Color Color::Cyan(0, 255, 255);
|
||||
const Color Color::Gray(80, 80, 80);
|
||||
const Color Color::Green(0, 255, 0);
|
||||
const Color Color::Magenta(255, 0, 255);
|
||||
const Color Color::Orange(255, 165, 0);
|
||||
const Color Color::Red(255, 0, 0);
|
||||
const Color Color::Yellow(255, 255, 0);
|
||||
const Color Color::White(255, 255, 255);
|
||||
const Color Color::Black(0.f, 0.f, 0.f);
|
||||
const Color Color::Blue(0.f, 0.f, 1.f);
|
||||
const Color Color::Cyan(0.f, 1.f, 1.f);
|
||||
const Color Color::Gray(80.f / 255.f, 80.f / 255.f, 80.f / 255.f);
|
||||
const Color Color::Green(0.f, 1.f, 0.f);
|
||||
const Color Color::Magenta(1.f, 0.f, 1.f);
|
||||
const Color Color::Orange(1.f, 165.f / 255.f, 0.f);
|
||||
const Color Color::Red(1.f, 0.f, 0.f);
|
||||
const Color Color::Yellow(1.f, 1.f, 0.f);
|
||||
const Color Color::White(1.f, 1.f, 1.f);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Nz
|
||||
const std::vector<UInt8>& bufferData = m_material.GetUniformBufferConstData(m_uniformBlockIndex);
|
||||
|
||||
const float* colorPtr = AccessByOffset<const float*>(bufferData.data(), m_basicUniformOffsets.diffuseColor);
|
||||
return Color(colorPtr[0] * 255, colorPtr[1] * 255, colorPtr[2] * 255, colorPtr[3] * 255); //< TODO: Make color able to use float
|
||||
return Color(colorPtr[0], colorPtr[1], colorPtr[2], colorPtr[3]);
|
||||
}
|
||||
|
||||
void BasicMaterial::SetAlphaTestThreshold(float alphaThreshold)
|
||||
@@ -86,10 +86,10 @@ namespace Nz
|
||||
std::vector<UInt8>& bufferData = m_material.GetUniformBufferData(m_uniformBlockIndex);
|
||||
|
||||
float* colorPtr = AccessByOffset<float*>(bufferData.data(), m_basicUniformOffsets.diffuseColor);
|
||||
colorPtr[0] = diffuse.r / 255.f;
|
||||
colorPtr[1] = diffuse.g / 255.f;
|
||||
colorPtr[2] = diffuse.b / 255.f;
|
||||
colorPtr[3] = diffuse.a / 255.f;
|
||||
colorPtr[0] = diffuse.r;
|
||||
colorPtr[1] = diffuse.g;
|
||||
colorPtr[2] = diffuse.b;
|
||||
colorPtr[3] = diffuse.a;
|
||||
}
|
||||
|
||||
MaterialSettings::Builder BasicMaterial::Build(BasicBuildOptions& options)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Nz
|
||||
auto lightOffset = PredefinedLightData::GetOffsets();
|
||||
|
||||
AccessByOffset<UInt32&>(data, lightOffset.lightMemberOffsets.type) = UnderlyingCast(BasicLightType::Directional);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.color) = Vector4f(m_color.r / 255.f, m_color.g / 255.f, m_color.b / 255.f, m_color.a / 255.f);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.color) = Vector4f(m_color.r, m_color.g, m_color.b, m_color.a);
|
||||
AccessByOffset<Vector2f&>(data, lightOffset.lightMemberOffsets.factor) = Vector2f(m_ambientFactor, m_diffuseFactor);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.parameter1) = Vector4f(m_direction.x, m_direction.y, m_direction.z, 0.f);
|
||||
AccessByOffset<UInt8&>(data, lightOffset.lightMemberOffsets.shadowMappingFlag) = 0;
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Nz
|
||||
const std::vector<UInt8>& bufferData = GetMaterial().GetUniformBufferConstData(m_uniformBlockIndex);
|
||||
|
||||
const float* colorPtr = AccessByOffset<const float*>(bufferData.data(), m_phongUniformOffsets.ambientColor);
|
||||
return Color(colorPtr[0] * 255, colorPtr[1] * 255, colorPtr[2] * 255, colorPtr[3] * 255); //< TODO: Make color able to use float
|
||||
return Color(colorPtr[0], colorPtr[1], colorPtr[2], colorPtr[3]);
|
||||
}
|
||||
|
||||
float Nz::PhongLightingMaterial::GetShininess() const
|
||||
@@ -98,7 +98,7 @@ namespace Nz
|
||||
const std::vector<UInt8>& bufferData = GetMaterial().GetUniformBufferConstData(m_uniformBlockIndex);
|
||||
|
||||
const float* colorPtr = AccessByOffset<const float*>(bufferData.data(), m_phongUniformOffsets.specularColor);
|
||||
return Color(colorPtr[0] * 255, colorPtr[1] * 255, colorPtr[2] * 255, colorPtr[3] * 255); //< TODO: Make color able to use float
|
||||
return Color(colorPtr[0], colorPtr[1], colorPtr[2], colorPtr[3]);
|
||||
}
|
||||
|
||||
void PhongLightingMaterial::SetAmbientColor(const Color& ambient)
|
||||
@@ -107,10 +107,10 @@ namespace Nz
|
||||
|
||||
std::vector<UInt8>& bufferData = GetMaterial().GetUniformBufferData(m_uniformBlockIndex);
|
||||
float* colorPtr = AccessByOffset<float*>(bufferData.data(), m_phongUniformOffsets.ambientColor);
|
||||
colorPtr[0] = ambient.r / 255.f;
|
||||
colorPtr[1] = ambient.g / 255.f;
|
||||
colorPtr[2] = ambient.b / 255.f;
|
||||
colorPtr[3] = ambient.a / 255.f;
|
||||
colorPtr[0] = ambient.r;
|
||||
colorPtr[1] = ambient.g;
|
||||
colorPtr[2] = ambient.b;
|
||||
colorPtr[3] = ambient.a;
|
||||
}
|
||||
|
||||
void PhongLightingMaterial::SetShininess(float shininess)
|
||||
@@ -127,10 +127,10 @@ namespace Nz
|
||||
|
||||
std::vector<UInt8>& bufferData = GetMaterial().GetUniformBufferData(m_uniformBlockIndex);
|
||||
float* colorPtr = AccessByOffset<float*>(bufferData.data(), m_phongUniformOffsets.specularColor);
|
||||
colorPtr[0] = diffuse.r / 255.f;
|
||||
colorPtr[1] = diffuse.g / 255.f;
|
||||
colorPtr[2] = diffuse.b / 255.f;
|
||||
colorPtr[3] = diffuse.a / 255.f;
|
||||
colorPtr[0] = diffuse.r;
|
||||
colorPtr[1] = diffuse.g;
|
||||
colorPtr[2] = diffuse.b;
|
||||
colorPtr[3] = diffuse.a;
|
||||
}
|
||||
|
||||
const std::shared_ptr<MaterialSettings>& PhongLightingMaterial::GetSettings()
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Nz
|
||||
auto lightOffset = PredefinedLightData::GetOffsets();
|
||||
|
||||
AccessByOffset<UInt32&>(data, lightOffset.lightMemberOffsets.type) = UnderlyingCast(BasicLightType::Point);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.color) = Vector4f(m_color.r / 255.f, m_color.g / 255.f, m_color.b / 255.f, m_color.a / 255.f);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.color) = Vector4f(m_color.r, m_color.g, m_color.b, m_color.a);
|
||||
AccessByOffset<Vector2f&>(data, lightOffset.lightMemberOffsets.factor) = Vector2f(m_ambientFactor, m_diffuseFactor);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.parameter1) = Vector4f(m_position.x, m_position.y, m_position.z, m_invRadius);
|
||||
AccessByOffset<UInt8&>(data, lightOffset.lightMemberOffsets.shadowMappingFlag) = 0;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Nz
|
||||
auto lightOffset = PredefinedLightData::GetOffsets();
|
||||
|
||||
AccessByOffset<UInt32&>(data, lightOffset.lightMemberOffsets.type) = UnderlyingCast(BasicLightType::Spot);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.color) = Vector4f(m_color.r / 255.f, m_color.g / 255.f, m_color.b / 255.f, m_color.a / 255.f);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.color) = Vector4f(m_color.r, m_color.g, m_color.b, m_color.a);
|
||||
AccessByOffset<Vector2f&>(data, lightOffset.lightMemberOffsets.factor) = Vector2f(m_ambientFactor, m_diffuseFactor);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.parameter1) = Vector4f(m_position.x, m_position.y, m_position.z, m_invRadius);
|
||||
AccessByOffset<Vector4f&>(data, lightOffset.lightMemberOffsets.parameter2) = Vector4f(m_direction.x, m_direction.y, m_direction.z, 0.f);
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace Nz
|
||||
switch (component)
|
||||
{
|
||||
case ComponentType::Color:
|
||||
attrib.normalized = GL_TRUE;
|
||||
attrib.normalized = GL_FALSE;
|
||||
attrib.size = 4;
|
||||
attrib.type = GL_UNSIGNED_BYTE;
|
||||
attrib.type = GL_FLOAT;
|
||||
return;
|
||||
|
||||
case ComponentType::Float1:
|
||||
@@ -49,7 +49,6 @@ namespace Nz
|
||||
case ComponentType::Double2:
|
||||
case ComponentType::Double3:
|
||||
case ComponentType::Double4:
|
||||
case ComponentType::Quaternion:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ namespace Nz
|
||||
std::size_t attachmentIndex = colorIndexes[i];
|
||||
|
||||
Color color = command.clearValues[attachmentIndex].color;
|
||||
std::array<GLfloat, 4> clearColor = { color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f };
|
||||
std::array<GLfloat, 4> clearColor = { color.r, color.g, color.b, color.a };
|
||||
|
||||
const auto& attachmentInfo = command.renderpass->GetAttachment(attachmentIndex);
|
||||
if (attachmentInfo.loadOp == AttachmentLoadOp::Clear)
|
||||
@@ -253,7 +252,7 @@ namespace Nz
|
||||
context->ResetColorWriteMasks();
|
||||
|
||||
Color color = command.clearValues[colorAttachmentIndex].color;
|
||||
context->glClearColor(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f);
|
||||
context->glClearColor(color.r, color.g, color.b, color.a);
|
||||
|
||||
clearFields |= GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Nz
|
||||
{
|
||||
Color CpDebugColorToColor(cpSpaceDebugColor c)
|
||||
{
|
||||
return Color{ static_cast<Nz::UInt8>(c.r * 255.f), static_cast<Nz::UInt8>(c.g * 255.f), static_cast<Nz::UInt8>(c.b * 255.f), static_cast<Nz::UInt8>(c.a * 255.f) };
|
||||
return Color{ c.r, c.g, c.b, c.a };
|
||||
}
|
||||
|
||||
cpSpaceDebugColor ColorToCpDebugColor(Color c)
|
||||
{
|
||||
return cpSpaceDebugColor{ c.r / 255.f, c.g / 255.f, c.b / 255.f, c.a / 255.f };
|
||||
return cpSpaceDebugColor{ c.r, c.g, c.b, c.a };
|
||||
}
|
||||
|
||||
void CpCircleCallback(cpVect pos, cpFloat angle, cpFloat radius, cpSpaceDebugColor outlineColor, cpSpaceDebugColor fillColor, cpDataPointer userdata)
|
||||
@@ -74,7 +74,7 @@ namespace Nz
|
||||
return ColorToCpDebugColor(drawOptions->colorCallback(rigidBody, rigidBody.GetShapeIndex(shape), drawOptions->userdata));
|
||||
}
|
||||
else
|
||||
return cpSpaceDebugColor{255.f, 0.f, 0.f, 255.f};
|
||||
return cpSpaceDebugColor{1.f, 0.f, 0.f, 1.f};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Nz
|
||||
{
|
||||
auto ColorToCpDebugColor = [](Color c) -> cpSpaceDebugColor
|
||||
{
|
||||
return cpSpaceDebugColor{ c.r / 255.f, c.g / 255.f, c.b / 255.f, c.a / 255.f };
|
||||
return cpSpaceDebugColor{ c.r, c.g, c.b, c.a };
|
||||
};
|
||||
|
||||
cpSpaceDebugDrawOptions drawOptions;
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Nz
|
||||
if (!currentMaterial)
|
||||
currentMaterial = AddMaterial("default");
|
||||
|
||||
currentMaterial->ambient = Color(static_cast<UInt8>(r * 255.f), static_cast<UInt8>(g * 255.f), static_cast<UInt8>(b * 255.f));
|
||||
currentMaterial->ambient = Color(r, g, b);
|
||||
}
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
else
|
||||
@@ -171,7 +171,7 @@ namespace Nz
|
||||
if (!currentMaterial)
|
||||
currentMaterial = AddMaterial("default");
|
||||
|
||||
currentMaterial->diffuse = Color(static_cast<UInt8>(r * 255.f), static_cast<UInt8>(g * 255.f), static_cast<UInt8>(b * 255.f));
|
||||
currentMaterial->diffuse = Color(r, g, b);
|
||||
}
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
else
|
||||
@@ -186,7 +186,7 @@ namespace Nz
|
||||
if (!currentMaterial)
|
||||
currentMaterial = AddMaterial("default");
|
||||
|
||||
currentMaterial->specular = Color(static_cast<UInt8>(r * 255.f), static_cast<UInt8>(g * 255.f), static_cast<UInt8>(b * 255.f));
|
||||
currentMaterial->specular = Color(r, g, b);
|
||||
}
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
else
|
||||
@@ -518,27 +518,27 @@ namespace Nz
|
||||
EmitLine();
|
||||
|
||||
Emit("Ka ");
|
||||
Emit(mat.ambient.r / 255.f);
|
||||
Emit(mat.ambient.r);
|
||||
Emit(' ');
|
||||
Emit(mat.ambient.g / 255.f);
|
||||
Emit(mat.ambient.g);
|
||||
Emit(' ');
|
||||
Emit(mat.ambient.b / 255.f);
|
||||
Emit(mat.ambient.b);
|
||||
EmitLine();
|
||||
|
||||
Emit("Kd ");
|
||||
Emit(mat.diffuse.r / 255.f);
|
||||
Emit(mat.diffuse.r);
|
||||
Emit(' ');
|
||||
Emit(mat.diffuse.g / 255.f);
|
||||
Emit(mat.diffuse.g);
|
||||
Emit(' ');
|
||||
Emit(mat.diffuse.b / 255.f);
|
||||
Emit(mat.diffuse.b);
|
||||
EmitLine();
|
||||
|
||||
Emit("Ks ");
|
||||
Emit(mat.specular.r / 255.f);
|
||||
Emit(mat.specular.r);
|
||||
Emit(' ');
|
||||
Emit(mat.specular.g / 255.f);
|
||||
Emit(mat.specular.g);
|
||||
Emit(' ');
|
||||
Emit(mat.specular.b / 255.f);
|
||||
Emit(mat.specular.b);
|
||||
EmitLine();
|
||||
|
||||
if (!NumberEquals(mat.alpha, 1.f))
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Nz
|
||||
{
|
||||
ParameterList data;
|
||||
|
||||
UInt8 alphaValue = static_cast<UInt8>(mtlMat->alpha*255.f);
|
||||
float alphaValue = mtlMat->alpha;
|
||||
|
||||
Color ambientColor(mtlMat->ambient);
|
||||
Color diffuseColor(mtlMat->diffuse);
|
||||
|
||||
@@ -715,7 +715,7 @@ namespace Nz
|
||||
const UInt8* pixel = GetPixelPtr(m_sharedImage->levels[0].get(), PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format), x, y, z, m_sharedImage->width, m_sharedImage->height);
|
||||
|
||||
Color color;
|
||||
if (!PixelFormatInfo::Convert(m_sharedImage->format, PixelFormat::RGBA8, pixel, &color.r))
|
||||
if (!PixelFormatInfo::Convert(m_sharedImage->format, PixelFormat::RGBA32F, pixel, &color.r))
|
||||
NazaraError("Failed to convert image's format to RGBA8");
|
||||
|
||||
return color;
|
||||
|
||||
@@ -269,6 +269,23 @@ namespace Nz
|
||||
return dst;
|
||||
}
|
||||
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::BGR8, PixelFormat::RGBA32F>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
{
|
||||
float* ptr = reinterpret_cast<float*>(dst);
|
||||
while (start < end)
|
||||
{
|
||||
*ptr++ = start[2] / 255.f;
|
||||
*ptr++ = start[1] / 255.f;
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = 1.f;
|
||||
|
||||
start += 3;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**********************************BGRA8**********************************/
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::BGRA8, PixelFormat::A8>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
@@ -409,6 +426,23 @@ namespace Nz
|
||||
return dst;
|
||||
}
|
||||
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::BGRA8, PixelFormat::RGBA32F>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
{
|
||||
float* ptr = reinterpret_cast<float*>(dst);
|
||||
while (start < end)
|
||||
{
|
||||
*ptr++ = start[2] / 255.f;
|
||||
*ptr++ = start[1] / 255.f;
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[3] / 255.f;
|
||||
|
||||
start += 4;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/***********************************L8************************************/
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::L8, PixelFormat::BGR8>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
@@ -534,6 +568,23 @@ namespace Nz
|
||||
return dst;
|
||||
}
|
||||
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::L8, PixelFormat::RGBA32F>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
{
|
||||
float* ptr = reinterpret_cast<float*>(dst);
|
||||
while (start < end)
|
||||
{
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = 1.f;
|
||||
|
||||
start += 1;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/***********************************LA8***********************************/
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::LA8, PixelFormat::A8>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
@@ -665,6 +716,23 @@ namespace Nz
|
||||
return dst;
|
||||
}
|
||||
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::LA8, PixelFormat::RGBA32F>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
{
|
||||
float* ptr = reinterpret_cast<float*>(dst);
|
||||
while (start < end)
|
||||
{
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[1] / 255.f;
|
||||
|
||||
start += 2;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/*********************************RGBA4***********************************/
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::RGBA4, PixelFormat::A8>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
@@ -1158,6 +1226,23 @@ namespace Nz
|
||||
return dst;
|
||||
}
|
||||
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::RGB8, PixelFormat::RGBA32F>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
{
|
||||
float* ptr = reinterpret_cast<float*>(dst);
|
||||
while (start < end)
|
||||
{
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[1] / 255.f;
|
||||
*ptr++ = start[2] / 255.f;
|
||||
*ptr++ = 1.f;
|
||||
|
||||
start += 3;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**********************************RGBA8**********************************/
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::RGBA8, PixelFormat::A8>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
@@ -1298,6 +1383,22 @@ namespace Nz
|
||||
return dst + count;
|
||||
}
|
||||
|
||||
template<>
|
||||
UInt8* ConvertPixels<PixelFormat::RGBA8, PixelFormat::RGBA32F>(const UInt8* start, const UInt8* end, UInt8* dst)
|
||||
{
|
||||
float* ptr = reinterpret_cast<float*>(dst);
|
||||
while (start < end)
|
||||
{
|
||||
*ptr++ = start[0] / 255.f;
|
||||
*ptr++ = start[1] / 255.f;
|
||||
*ptr++ = start[2] / 255.f;
|
||||
*ptr++ = start[3] / 255.f;
|
||||
|
||||
start += 4;
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
template<PixelFormat Format1, PixelFormat Format2>
|
||||
void RegisterConverter()
|
||||
@@ -1515,6 +1616,7 @@ namespace Nz
|
||||
RegisterConverter<PixelFormat::BGR8, PixelFormat::RGB8>();
|
||||
RegisterConverter<PixelFormat::BGR8, PixelFormat::RGBA4>();
|
||||
RegisterConverter<PixelFormat::BGR8, PixelFormat::RGBA8>();
|
||||
RegisterConverter<PixelFormat::BGR8, PixelFormat::RGBA32F>();
|
||||
|
||||
/**********************************BGRA8**********************************/
|
||||
RegisterConverter<PixelFormat::BGRA8, PixelFormat::A8>();
|
||||
@@ -1534,6 +1636,7 @@ namespace Nz
|
||||
RegisterConverter<PixelFormat::BGRA8, PixelFormat::RGB8>();
|
||||
RegisterConverter<PixelFormat::BGRA8, PixelFormat::RGBA4>();
|
||||
RegisterConverter<PixelFormat::BGRA8, PixelFormat::RGBA8>();
|
||||
RegisterConverter<PixelFormat::BGRA8, PixelFormat::RGBA32F>();
|
||||
|
||||
/**********************************DXT1***********************************/
|
||||
///TODO: Décompresseur DXT1
|
||||
@@ -1620,6 +1723,7 @@ namespace Nz
|
||||
RegisterConverter<PixelFormat::L8, PixelFormat::RGB8>();
|
||||
RegisterConverter<PixelFormat::L8, PixelFormat::RGBA4>();
|
||||
RegisterConverter<PixelFormat::L8, PixelFormat::RGBA8>();
|
||||
RegisterConverter<PixelFormat::L8, PixelFormat::RGBA32F>();
|
||||
|
||||
/***********************************LA8***********************************/
|
||||
RegisterConverter<PixelFormat::LA8, PixelFormat::A8>();
|
||||
@@ -1638,6 +1742,7 @@ namespace Nz
|
||||
RegisterConverter<PixelFormat::LA8, PixelFormat::RGB8>();
|
||||
RegisterConverter<PixelFormat::LA8, PixelFormat::RGBA4>();
|
||||
RegisterConverter<PixelFormat::LA8, PixelFormat::RGBA8>();
|
||||
RegisterConverter<PixelFormat::LA8, PixelFormat::RGBA32F>();
|
||||
|
||||
/**********************************RGBA4**********************************/
|
||||
RegisterConverter<PixelFormat::RGBA4, PixelFormat::A8>();
|
||||
@@ -1692,6 +1797,7 @@ namespace Nz
|
||||
RegisterConverter<PixelFormat::RGB8, PixelFormat::RGB8_SRGB>();
|
||||
RegisterConverter<PixelFormat::RGB8, PixelFormat::RGBA4>();
|
||||
RegisterConverter<PixelFormat::RGB8, PixelFormat::RGBA8>();
|
||||
RegisterConverter<PixelFormat::RGB8, PixelFormat::RGBA32F>();
|
||||
|
||||
/**********************************RGBA8**********************************/
|
||||
RegisterConverter<PixelFormat::RGBA8, PixelFormat::A8>();
|
||||
@@ -1711,6 +1817,7 @@ namespace Nz
|
||||
RegisterConverter<PixelFormat::RGBA8, PixelFormat::RGB8>();
|
||||
RegisterConverter<PixelFormat::RGBA8, PixelFormat::RGBA4>();
|
||||
RegisterConverter<PixelFormat::RGBA8, PixelFormat::RGBA8_SRGB>();
|
||||
RegisterConverter<PixelFormat::RGBA8, PixelFormat::RGBA32F>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Nz
|
||||
{
|
||||
std::size_t s_componentStride[ComponentTypeCount] =
|
||||
{
|
||||
4 * sizeof(UInt8), // ComponentType::Color
|
||||
4 * sizeof(float), // ComponentType::Color
|
||||
1 * sizeof(double), // ComponentType::Double1
|
||||
2 * sizeof(double), // ComponentType::Double2
|
||||
3 * sizeof(double), // ComponentType::Double3
|
||||
@@ -31,7 +31,6 @@ namespace Nz
|
||||
2 * sizeof(UInt32), // ComponentType::Int2
|
||||
3 * sizeof(UInt32), // ComponentType::Int3
|
||||
4 * sizeof(UInt32), // ComponentType::Int4
|
||||
4 * sizeof(float) // ComponentType::Quaternion
|
||||
};
|
||||
}
|
||||
VertexDeclaration::VertexDeclaration(VertexInputRate inputRate, std::initializer_list<ComponentEntry> components) :
|
||||
@@ -74,7 +73,6 @@ namespace Nz
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ComponentType::Color:
|
||||
case ComponentType::Double1:
|
||||
case ComponentType::Double2:
|
||||
case ComponentType::Double3:
|
||||
@@ -88,9 +86,6 @@ namespace Nz
|
||||
case ComponentType::Int3:
|
||||
case ComponentType::Int4:
|
||||
return true;
|
||||
|
||||
case ComponentType::Quaternion:
|
||||
return false;
|
||||
}
|
||||
|
||||
NazaraError("Component type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')');
|
||||
@@ -127,7 +122,7 @@ namespace Nz
|
||||
},
|
||||
{
|
||||
VertexComponent::Color,
|
||||
ComponentType::Color,
|
||||
ComponentType::Float4,
|
||||
0
|
||||
},
|
||||
});
|
||||
@@ -170,7 +165,7 @@ namespace Nz
|
||||
},
|
||||
{
|
||||
VertexComponent::Color,
|
||||
ComponentType::Color,
|
||||
ComponentType::Float4,
|
||||
0
|
||||
}
|
||||
});
|
||||
@@ -186,7 +181,7 @@ namespace Nz
|
||||
},
|
||||
{
|
||||
VertexComponent::Color,
|
||||
ComponentType::Color,
|
||||
ComponentType::Float4,
|
||||
0
|
||||
},
|
||||
{
|
||||
|
||||
@@ -43,10 +43,10 @@ namespace Nz
|
||||
|
||||
if (PixelFormatInfo::GetContent(vkRenderPass.GetAttachment(i).format) == PixelFormatContent::ColorRGBA)
|
||||
{
|
||||
vkValues.color.float32[0] = values.color.r / 255.f;
|
||||
vkValues.color.float32[1] = values.color.g / 255.f;
|
||||
vkValues.color.float32[2] = values.color.b / 255.f;
|
||||
vkValues.color.float32[3] = values.color.a / 255.f;
|
||||
vkValues.color.float32[0] = values.color.r;
|
||||
vkValues.color.float32[1] = values.color.g;
|
||||
vkValues.color.float32[2] = values.color.b;
|
||||
vkValues.color.float32[3] = values.color.a;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -596,7 +596,7 @@ namespace Nz
|
||||
float endX = (i == m_cursorPositionEnd.y) ? GetGlyphPos({ m_cursorPositionEnd.x, i }) : lineInfo.bounds.width;
|
||||
float spriteSize = std::max(endX - beginX, 1.f);
|
||||
|
||||
cursor.sprite->SetColor((m_cursorPositionBegin == m_cursorPositionEnd) ? Color::Black : Color(0, 0, 0, 50));
|
||||
cursor.sprite->SetColor((m_cursorPositionBegin == m_cursorPositionEnd) ? Color::Black : Color(0.f, 0.f, 0.f, 0.2f));
|
||||
cursor.sprite->SetSize(Vector2f(spriteSize, lineInfo.bounds.height));
|
||||
|
||||
registry.get<NodeComponent>(cursor.entity).SetPosition(beginX, textHeight - lineInfo.bounds.y - lineInfo.bounds.height);
|
||||
@@ -604,7 +604,7 @@ namespace Nz
|
||||
else
|
||||
{
|
||||
// Full line selection
|
||||
cursor.sprite->SetColor(Color(0, 0, 0, 50));
|
||||
cursor.sprite->SetColor(Color(0.f, 0.f, 0.f, 0.2f));
|
||||
cursor.sprite->SetSize(Vector2f(lineInfo.bounds.width, lineInfo.bounds.height));
|
||||
|
||||
registry.get<NodeComponent>(cursor.entity).SetPosition(0.f, textHeight - lineInfo.bounds.y - lineInfo.bounds.height);
|
||||
|
||||
@@ -18,15 +18,15 @@ namespace Nz
|
||||
{
|
||||
switch (character)
|
||||
{
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
case '\v':
|
||||
return true;
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
case '\v':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return Unicode::GetCategory(character) & Unicode::Category_Separator;
|
||||
default:
|
||||
return Unicode::GetCategory(character) & Unicode::Category_Separator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user