Cogs.Core
TransformVertices.h
1#pragma once
2#include "Base.h"
3#include <vector>
4#include <glm/glm.hpp>
5
6namespace Cogs
7{
8 namespace Core
9 {
10 class Context;
11
12
13
14 COGSCORE_DLL_API void transformVertex3ToVertex4(Context* context,
15 uint8_t* dst,
16 const size_t dst_stride,
17 const size_t dst_bytes,
18 const glm::mat4& matrix,
19 const uint8_t* src,
20 const size_t src_stride,
21 const size_t src_bytes,
22 const size_t src_count);
23
24 inline void transformVertices(Context* context,
25 std::vector<glm::vec4>& dst,
26 const glm::mat4& matrix,
27 const std::vector<glm::vec3>& src)
28 {
29 transformVertex3ToVertex4(context,
30 reinterpret_cast<uint8_t*>(dst.data()),
31 sizeof(glm::vec4),
32 sizeof(glm::vec4)*dst.size(),
33 matrix,
34 reinterpret_cast<const uint8_t*>(src.data()),
35 sizeof(glm::vec3),
36 sizeof(glm::vec3)*src.size(),
37 src.size());
38 }
39
40 inline void transformVertices(Context* context,
41 std::vector<glm::vec4>& dst,
42 const glm::mat4& matrix,
43 const std::vector<glm::vec3>& src,
44 size_t offset,
45 size_t count )
46 {
47#ifdef _DEBUG
48 assert(offset + count <= src.size());
49#endif
50 transformVertex3ToVertex4(context,
51 reinterpret_cast<uint8_t*>(dst.data()),
52 sizeof(glm::vec4),
53 sizeof(glm::vec4)*dst.size(),
54 matrix,
55 reinterpret_cast<const uint8_t*>(src.data()+offset),
56 sizeof(glm::vec3),
57 sizeof(glm::vec3)*(src.size()-offset),
58 count);
59 }
60
61
62
63 }
64}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23