libcootapi
 
Loading...
Searching...
No Matches
vertex.hh
1/*
2 * coot-utils/vertex.hh
3 *
4 * Copyright 2022 by Medical Research Council
5 * Author: Paul Emsley
6 *
7 * This file is part of Coot
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copies of the GNU General Public License and
20 * the GNU Lesser General Public License along with this program; if not,
21 * write to the Free Software Foundation, Inc., 51 Franklin Street,
22 * Fifth Floor, Boston, MA, 02110-1301, USA.
23 * See http://www.gnu.org/licenses/
24 *
25 */
26#ifndef VERTEX_HH
27#define VERTEX_HH
28
29#include <glm/glm.hpp>
30
31// for standard objects at the origin - typically used in instancing
32namespace coot {
33
34 namespace api {
35
37 class vn_vertex {
38 public:
39 glm::vec3 pos;
40 glm::vec3 normal; // normalized on input
41 vn_vertex(const glm::vec3 &pos_in,
42 const glm::vec3 &norm_in) :
43 pos(pos_in), normal(norm_in) {}
44 vn_vertex() {}
45 };
46
48 class vnc_vertex {
49 public:
50 glm::vec3 pos;
51 glm::vec3 normal; // normalized on input
52 glm::vec4 color; // or colour?
53 vnc_vertex(const glm::vec3 &pos_in,
54 const glm::vec3 &norm_in,
55 const glm::vec4 &col_in) : pos(pos_in), normal(norm_in), color(col_in) {}
56 explicit vnc_vertex(const vn_vertex &vn) :
57 pos(vn.pos), normal(vn.normal), color(glm::vec4(0.5, 0.5, 0.5, 1.0)) {}
58 vnc_vertex(const vn_vertex &vn, const glm::vec4 &c) : pos(vn.pos), normal(vn.normal), color(c) {}
59 vnc_vertex() {}
60 };
61
66 public:
67 glm::mat3 model_rotation_matrix; // orientation
68 glm::vec3 model_translation; // the coordinates of the first atom of the bond
69 glm::vec3 pos;
70 glm::vec3 normal; // normalized when set
71 glm::vec4 colour;
73 vertex_with_rotation_translation(const glm::vec3 &p, const glm::vec3 &n, const glm::vec4 &c) : pos(p), normal(n), colour(c) {}
75 vertex_with_rotation_translation(const vnc_vertex &v, const glm::vec3 &atom_position, float scale) :
76 model_rotation_matrix(glm::mat3(1.0f)), model_translation(atom_position),
77 pos(v.pos * scale), normal(v.normal), colour(v.color) {}
78
80 };
81 }
82}
83
84
85#endif // VERTEX_HH
vertex_with_rotation_translation(const vnc_vertex &v, const glm::vec3 &atom_position, float scale)
constructor
Definition vertex.hh:75
vertex_with_rotation_translation(const glm::vec3 &p, const glm::vec3 &n, const glm::vec4 &c)
constructor
Definition vertex.hh:73
vertex_with_rotation_translation()
constructor
Definition vertex.hh:79
a vertex with (only) postion and normal. Useful for instancing, perhaps
Definition vertex.hh:37
a vertex with postion, normal and colour
Definition vertex.hh:48