Leviathan  0.8.0.0
Leviathan game engine
Material.h
Go to the documentation of this file.
1 // Leviathan Game Engine
2 // Copyright (c) 2012-2020 Henri Hyyryläinen
3 #pragma once
4 #include "Define.h"
5 // ------------------------------------ //
6 #include "Shader.h"
7 #include "Texture.h"
8 
10 #include "Common/Types.h"
11 
12 #include "bsfCore/BsCorePrerequisites.h"
13 
14 namespace Leviathan {
15 
16 class Material : public ReferenceCounted {
17  // These are protected for only constructing properly reference
18  // counted instances through MakeShared
19  friend ReferenceCounted;
20  DLLEXPORT Material(const Shader::pointer& shader);
22 
23 public:
24  // Setting functions for shader parameters
25  DLLEXPORT void SetTexture(const std::string& parameter, const Texture::pointer& texture);
26  DLLEXPORT void SetFloat4(const std::string& parameter, const Float4& data);
27  DLLEXPORT void SetFloat(const std::string& parameter, float data);
28 
29 
30  DLLEXPORT void SetVariation(const std::string& variation, bool set);
31 
32 
33  bs::HMaterial GetInternal()
34  {
35  return BsMaterial;
36  }
37 
38  void SetTextureWrapper(const std::string& parameter, Texture* texture)
39  {
40  SetTexture(parameter, Texture::WrapPtr(texture));
41  }
42 
44 
45 private:
46  bs::HMaterial BsMaterial;
47  Shader::pointer _Shader;
48 };
49 
50 } // namespace Leviathan
void SetTextureWrapper(const std::string &parameter, Texture *texture)
Definition: Material.h:38
DLLEXPORT void SetTexture(const std::string &parameter, const Texture::pointer &texture)
Definition: Material.cpp:14
DLLEXPORT void SetFloat(const std::string &parameter, float data)
Definition: Material.cpp:31
DLLEXPORT void SetFloat4(const std::string &parameter, const Float4 &data)
Definition: Material.cpp:23
DLLEXPORT void SetVariation(const std::string &variation, bool set)
Definition: Material.cpp:39
bs::HMaterial GetInternal()
Definition: Material.h:33
REFERENCE_COUNTED_PTR_TYPE(Material)
#define DLLEXPORT
Definition: Include.h:84
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12
static boost::intrusive_ptr< ActualType > WrapPtr(ActualType *ptr)
Creates an intrusive_ptr from raw pointer.