26 : band_width_(0.2), max_length_(max_length) {
41 bool sufficient_delta =
false;
42 if (!need_to_initialize) {
46 sufficient_delta = kMinDistanceSquared <
50 if (need_to_initialize || sufficient_delta) {
59 if (mode == BandMode::kNormal || mode == BandMode::kKeepRight) {
64 if (mode == BandMode::kNormal || mode == BandMode::kKeepLeft) {
70 if (mode != BandMode::kNormal) {
75 head_m[3][0] = position.
x;
76 head_m[3][1] = position.
y;
77 head_m[3][2] = position.
z;
80 if (need_to_initialize) {
111 for (
size_t i = 0; i < v.size() - 1; ++i) {
122 if (i == v.size() - 2) {
136 glm::mat4 mvp_mat = projection_mat * view_mat * model_mat;
144 glDrawArrays(GL_TRIANGLE_STRIP, 0,
vertices_v_.size());
Band(const unsigned int max_legnth)
void Render(const glm::mat4 &projection_mat, const glm::mat4 &view_mat) const
void SetVertexArray(const std::vector< glm::vec3 > &v, const glm::vec3 &up)
glm::vec3 GetTranslationFromMatrix(const glm::mat4 &mat)
static const float kMinDistanceSquared
float DistanceSquared(const glm::vec3 &v1, const glm::vec3 &v2)
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &vec)
GLM_FUNC_DECL genType normalize(genType const &x)
void SetWidth(const float width)
GLM_FUNC_DECL detail::tvec3< T, P > cross(detail::tvec3< T, P > const &x, detail::tvec3< T, P > const &y)
glm::vec3 ApplyTransform(const glm::mat4 &mat, const glm::vec3 &vec)
void UpdateVertexArray(const glm::mat4 m, BandMode mode)
void glUniformMatrix4fv(GLuint, int, int, float *)
std::vector< glm::vec3 > vertices_v_
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)