DRAFT Source geometry 4 sides crop

This commit is contained in:
Bruno Herbelin
2023-12-16 20:52:36 +01:00
parent d66751b6ac
commit 53bd7d6ae2
9 changed files with 616 additions and 6 deletions

View File

@@ -219,6 +219,7 @@ Handles::Handles(Type type) : Node(), type_(type)
static Mesh *handle_eyeslash = new Mesh("mesh/icon_eye_slash.ply");
static Mesh *handle_shadow = new Mesh("mesh/border_handles_shadow.ply", "images/soft_shadow.dds");
static Mesh *handle_node = new Mesh("mesh/border_handles_sharp.ply");
static Mesh *handle_crop_h = new Mesh("mesh/border_handles_arrows.ply");
color = glm::vec4( 1.f, 1.f, 1.f, 1.f);
corner_ = glm::vec2(0.f, 0.f);
@@ -251,6 +252,12 @@ Handles::Handles(Type type) : Node(), type_(type)
else if ( type_ >= Handles::NODE_LOWER_LEFT && type_ <= Handles::NODE_UPPER_RIGHT ) {
handle_ = handle_node;
}
else if ( type_ == Handles::CROP_H ) {
handle_ = handle_crop_h;
}
else if ( type_ == Handles::CROP_V ) {
handle_ = handle_crop_h;
}
else {
handle_ = handle_corner;
}
@@ -450,6 +457,29 @@ void Handles::draw(glm::mat4 modelview, glm::mat4 projection)
// 2. draw
handle_->draw( ctm, projection );
}
else if ( type_ == Handles::CROP_H ){
// left and right
vec = modelview * glm::vec4(1.f, 0.f, 0.f, 1.f);
ctm = GlmToolkit::transform(vec, rot, glm::vec3(1.f));
handle_->draw( ctm, projection );
vec = modelview * glm::vec4(-1.f, 0.f, 0.f, 1.f);
ctm = GlmToolkit::transform(vec, rot, glm::vec3(1.f));
handle_->draw( ctm, projection );
}
else if ( type_ == Handles::CROP_V ){
// top and bottom
vec = modelview * glm::vec4(0.f, 1.f, 0.f, 1.f);
ctm = GlmToolkit::transform(vec, rot, glm::vec3(1.f));
ctm = glm::rotate(ctm, M_PI_2f, glm::vec3(0.f, 0.f, 1.f));
handle_->draw( ctm, projection );
vec = modelview * glm::vec4(0.f, -1.f, 0.f, 1.f);
ctm = GlmToolkit::transform(vec, rot, glm::vec3(1.f));
ctm = glm::rotate(ctm, M_PI_2f, glm::vec3(0.f, 0.f, 1.f));
handle_->draw( ctm, projection );
}
}
}