Euphoria
actor.cc
Go to the documentation of this file.
1 #include "render/actor.h"
2 
3 #include "assert/assert.h"
4 
5 namespace eu::render
6 {
7  Actor::Actor(const std::shared_ptr<CompiledMesh>& m)
8  : mesh(m)
9  {
10  ASSERT(m);
11  }
12 
13 
14  std::shared_ptr<MaterialOverride>
16  {
17  const auto s = mesh->materials.size();
18  auto r = std::make_shared<MaterialOverride>();
19  r->materials.resize(s);
20  for(std::size_t index=0; index<s; index+=1)
21  {
22  r->materials[index] = mesh->materials[index];
23  }
24  return r;
25  }
26 
27 
28  void
30  (
31  const mat4f& projection_matrix,
32  const mat4f& view_matrix,
33  const vec3f& camera,
34  const Light& light
35  )
36  {
37  mesh->render
38  (
40  projection_matrix,
41  view_matrix,
42  camera,
43  light,
45  );
46  }
47 
48 }
#define ASSERT(x)
Definition: assert.h:29
Definition: mat4.h:14
Actor(const std::shared_ptr< CompiledMesh > &mesh)
Definition: actor.cc:7
void render(const mat4f &projection_matrix, const mat4f &view_matrix, const vec3f &camera, const Light &light) override
Definition: actor.cc:30
std::shared_ptr< MaterialOverride > overriden_materials
Definition: actor.h:23
std::shared_ptr< MaterialOverride > create_override() const
Definition: actor.cc:15
std::shared_ptr< CompiledMesh > mesh
Definition: actor.h:22
mat4f calc_model_matrix() const
Definition: instance.cc:12
Definition: vec3.h:48