]> git.tdb.fi Git - libs/gl.git/blob - source/builders/geometrybuilder.cpp
Replace some local pointers with references in VulkanCommands
[libs/gl.git] / source / builders / geometrybuilder.cpp
1 #include "geometrybuilder.h"
2 #include "meshbuilder.h"
3
4 namespace Msp {
5 namespace GL {
6
7 GeometryBuilder &GeometryBuilder::tangents(bool t)
8 {
9         generate_tan = t;
10         return *this;
11 }
12
13 GeometryBuilder &GeometryBuilder::texture_fit(TextureFit tf)
14 {
15         tex_fit = tf;
16         return *this;
17 }
18
19 void GeometryBuilder::adjust_texture_scale(float &u_scale, float &v_scale, float width, float height) const
20 {
21         if(tex_fit!=STRETCH)
22         {
23                 if((width<height)==(tex_fit==CROP))
24                         u_scale *= width/height;
25                 else
26                         v_scale *= height/width;
27         }
28 }
29
30 void GeometryBuilder::build(Mesh &mesh) const
31 {
32         MeshBuilder builder(mesh);
33         builder.auto_offset();
34         build(builder);
35 }
36
37 } // namespace GL
38 } // namespace Msp