Minor stuff

This commit is contained in:
Jérôme Leclercq 2021-01-22 23:23:28 +01:00
parent d52be87fd5
commit a6ff64106e
10 changed files with 26 additions and 10 deletions

View File

@ -105,10 +105,10 @@ int main()
material.EnableDepthBuffer(true);
Nz::BasicMaterial basicMat(material);
basicMat.EnableAlphaTest(true);
basicMat.EnableAlphaTest(false);
basicMat.SetAlphaMap(alphaTexture);
basicMat.SetAlphaSampler(textureSampler);
basicMat.SetDiffuseMap(alphaTexture);
basicMat.SetDiffuseMap(texture);
basicMat.SetDiffuseSampler(textureSampler);
Nz::PredefinedInstanceData instanceUboOffsets = Nz::PredefinedInstanceData::GetOffsets();

Binary file not shown.

View File

@ -115,7 +115,7 @@ namespace Nz
std::vector<MaterialTexture> m_textures;
std::vector<UniformBufferRef> m_uniformBuffers;
mutable std::shared_ptr<MaterialPipeline> m_pipeline;
UInt32 m_enabledConditions;
UInt64 m_enabledConditions;
mutable MaterialPipelineInfo m_pipelineInfo;
mutable bool m_pipelineUpdated;
bool m_shadowCastingEnabled;

View File

@ -12,10 +12,13 @@ namespace Nz
{
inline std::optional<GLTextureFormat> DescribeTextureFormat(PixelFormat pixelFormat)
{
// TODO: Fill this switch
switch (pixelFormat)
{
case PixelFormat_A8: return GLTextureFormat { GL_R8, GL_RED, GL_UNSIGNED_BYTE, GL_ZERO, GL_ZERO, GL_ZERO, GL_RED };
case PixelFormat_RGB8: return GLTextureFormat { GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, GL_RED, GL_GREEN, GL_BLUE, GL_ZERO };
case PixelFormat_BGR8: return GLTextureFormat { GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, GL_BLUE, GL_GREEN, GL_RED, GL_ONE };
case PixelFormat_BGRA8: return GLTextureFormat { GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA };
case PixelFormat_RGB8: return GLTextureFormat { GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, GL_RED, GL_GREEN, GL_BLUE, GL_ONE };
case PixelFormat_RGBA8: return GLTextureFormat { GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
default: break;
}

View File

@ -56,7 +56,6 @@ namespace Nz::GL
const Context& context = EnsureDeviceContext();
context.BindTexture(m_target, m_objectId);
context.glTexImage2D(ToOpenGL(m_target), level, internalFormat, width, height, border, format, type, data);
//< TODO: Handle errors
}
inline void Texture::TexSubImage2D(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* data)

View File

@ -19,9 +19,9 @@ namespace Nz
{
PixelFormat pixelFormat;
ImageType type;
UInt8 mipmapLevel = 1;
unsigned int depth = 1;
unsigned int height;
unsigned int mipmapLevel = 1;
unsigned int width;
};

View File

@ -146,6 +146,8 @@ namespace Nz
ImageType_Max = ImageType_Cubemap
};
constexpr std::size_t ImageTypeCount = static_cast<std::size_t>(ImageType_Max) + 1;
enum NodeType
{
NodeType_Default, // Node

View File

@ -3,7 +3,6 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/OpenGLRenderer/OpenGLShaderStage.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/MemoryView.hpp>
#include <Nazara/OpenGLRenderer/Utils.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
@ -89,8 +88,6 @@ namespace Nz
std::string code = writer.Generate(shaderAst, states);
NazaraError(code);
m_shader.SetSource(code.data(), code.size());
m_shader.Compile();
}

View File

@ -30,7 +30,7 @@ namespace Nz::GL
if (setup.indexBuffer != 0)
m_context.BindBuffer(BufferTarget::ElementArray, setup.indexBuffer, true);
std::size_t bindingIndex = 0;
GLuint bindingIndex = 0;
for (const auto& attribOpt : setup.vertexAttribs)
{
if (attribOpt)

View File

@ -227,8 +227,23 @@ namespace Nz
VK_COMPONENT_SWIZZLE_A
};
// TODO: Fill this switch
switch (pixelFormat)
{
case PixelFormat_BGR8:
{
createImage.format = VK_FORMAT_B8G8R8_SRGB;
createImageView.format = createImage.format;
break;
}
case PixelFormat_BGRA8:
{
createImage.format = VK_FORMAT_B8G8R8A8_SRGB;
createImageView.format = createImage.format;
break;
}
case PixelFormat_L8:
{
createImage.format = VK_FORMAT_R8_SRGB;