Added pixel format support Added MemoryStream Added Rect Added ResourceLoader Added generic loader (bmp, gif, hdr, jpg, jpeg, pic, png, psd, tga) Added PCX loader Added utility module initializer Fixed Config.hpp include Prerequesites.hpp now overwrites _WIN32_WINNT when defined version is less than requiered version Renderer's initialisation will implicitly initialize utility module Removed RENDERER_SINGLETON option Shaders are now resources
80 lines
1.8 KiB
C++
80 lines
1.8 KiB
C++
// Copyright (C) 2012 Jérôme Leclercq
|
|
// This file is part of the "Nazara Engine".
|
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
|
|
|
#pragma once
|
|
|
|
#ifndef NAZARA_SHADER_HPP
|
|
#define NAZARA_SHADER_HPP
|
|
|
|
#include <Nazara/Prerequesites.hpp>
|
|
#include <Nazara/Core/String.hpp>
|
|
#include <Nazara/Math/Matrix4.hpp>
|
|
#include <Nazara/Utility/NonCopyable.hpp>
|
|
#include <Nazara/Utility/Resource.hpp>
|
|
|
|
enum nzShaderLanguage
|
|
{
|
|
nzShaderLanguage_Unknown,
|
|
|
|
nzShaderLanguage_Cg,
|
|
nzShaderLanguage_GLSL
|
|
};
|
|
|
|
enum nzShaderType
|
|
{
|
|
nzShaderType_Fragment,
|
|
nzShaderType_Geometry,
|
|
nzShaderType_Vertex,
|
|
|
|
nzShaderType_Count
|
|
};
|
|
|
|
class NzRenderer;
|
|
class NzShaderImpl;
|
|
|
|
class NAZARA_API NzShader : public NzResource, NzNonCopyable
|
|
{
|
|
friend class NzRenderer;
|
|
|
|
public:
|
|
NzShader();
|
|
NzShader(nzShaderLanguage language);
|
|
~NzShader();
|
|
|
|
bool Create(nzShaderLanguage language);
|
|
bool Compile();
|
|
|
|
void Destroy();
|
|
|
|
NzString GetLog() const;
|
|
nzShaderLanguage GetLanguage() const;
|
|
NzString GetSourceCode(nzShaderType type) const;
|
|
|
|
bool IsCompiled() const;
|
|
bool IsLoaded(nzShaderType type) const;
|
|
|
|
bool Load(nzShaderType type, const NzString& source);
|
|
bool LoadFromFile(nzShaderType type, const NzString& source);
|
|
|
|
bool Lock();
|
|
|
|
bool SendBoolean(const NzString& name, bool value);
|
|
bool SendDouble(const NzString& name, double value);
|
|
bool SendFloat(const NzString& name, float value);
|
|
bool SendInteger(const NzString& name, int value);
|
|
bool SendMatrix(const NzString& name, const NzMatrix4d& matrix);
|
|
bool SendMatrix(const NzString& name, const NzMatrix4f& matrix);
|
|
|
|
void Unlock();
|
|
|
|
static bool IsLanguageSupported(nzShaderLanguage language);
|
|
static bool IsTypeSupported(nzShaderType type);
|
|
|
|
private:
|
|
NzShaderImpl* m_impl;
|
|
bool m_compiled;
|
|
};
|
|
|
|
#endif // NAZARA_SHADER_HPP
|