git-svn-id: svn://db.shs.com.ru/libs@707 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-12-23 14:24:46 +00:00
parent 056eea2407
commit 7c1dd9bf0a
7 changed files with 68 additions and 26 deletions

View File

@@ -88,7 +88,8 @@ RendererService::RendererService(Renderer * r_): r(r_) {
m->transformPoints(mat);
camera_mesh_f->append(m);
line_mesh_f = Primitive::lineFrame(QVector3D(), QVector3D(0, 0, -1));
line_spot_f = Primitive::lineFrame(QVector3D(), QVector3D(0, 0, -1));
line_camera_f = Primitive::lineFrame(QVector3D(), QVector3D(0, 0, -1));
handle_move_mesh = Primitive::arrow(12, 0.06);
handle_ms_2_mesh = Primitive::torus(8, 12, 0.5, 0.02, 90);
@@ -128,7 +129,8 @@ RendererService::~RendererService() {
delete cone_mesh_f;
delete camera_mesh;
delete camera_mesh_f;
delete line_mesh_f;
delete line_spot_f;
delete line_camera_f;
delete axis_camera;
delete axis_mesh;
delete handle_move_mesh;
@@ -202,14 +204,14 @@ void RendererService::fillOmniObjects() {
}
void RendererService::fillAimedObjects(const ObjectBaseList & objects) {
void RendererService::fillAimedObjects(const ObjectBaseList & objects, Mesh * line_mesh) {
Object o;
cur_objects.clear();
cur_aims.clear();
QVector<QVector3D> & lv (line_mesh_f->vertices ());
QVector<QVector3D> & ln (line_mesh_f->normals ());
QVector<QVector2D> & lt (line_mesh_f->texcoords ());
QVector< Vector2i> & lind(line_mesh_f->indicesLines());
QVector<QVector3D> & lv (line_mesh->vertices ());
QVector<QVector3D> & ln (line_mesh->normals ());
QVector<QVector2D> & lt (line_mesh->texcoords ());
QVector< Vector2i> & lind(line_mesh->indicesLines());
lv.clear();
foreach (ObjectBase * go, objects) {
AimedObject * ao = (AimedObject *)go;
@@ -333,7 +335,7 @@ void RendererService::drawLights() {
omni_mesh->draw(v, cur_objects.size());
ObjectBaseList ll = lights2objectList(r->view->scene()->lights_used.value(Light::Cone));
fillAimedObjects(ll);
fillAimedObjects(ll, line_spot_f);
cone_mesh->loadObjects(v, cur_objects);
r->fillSelectionsBuffer(rs.cur_selections_, ll);
cone_mesh->loadSelections(v, rs.cur_selections_);
@@ -357,7 +359,7 @@ void RendererService::drawLightsFrame(QColor color) {
omni_mesh_f->draw(v, cur_objects.size());
ObjectBaseList ll = lights2objectList(r->view->scene()->lights_used.value(Light::Cone));
fillAimedObjects(ll);
fillAimedObjects(ll, line_spot_f);
setObjectsColor(cur_objects, color);
cone_mesh_f->loadObjects(v, cur_objects);
r->fillSelectionsBuffer(rs.cur_selections_, ll);
@@ -378,7 +380,7 @@ void RendererService::drawCameras() {
ObjectBaseList cl = cameras2objectList(r->view->scene()->cameras_used);
cl.removeOne(r->view->camera());
fillAimedObjects(cl);
fillAimedObjects(cl, line_camera_f);
camera_mesh->loadObjects(v, cur_objects);
r->fillSelectionsBuffer(rs.cur_selections_, cl);
camera_mesh->loadSelections(v, rs.cur_selections_);
@@ -396,7 +398,7 @@ void RendererService::drawCamerasFrame(QColor color) {
ObjectBaseList cl = cameras2objectList(r->view->scene()->cameras_used);
cl.removeOne(r->view->camera());
fillAimedObjects(cl);
fillAimedObjects(cl, line_camera_f);
setObjectsColor(cur_objects, color);
camera_mesh_f->loadObjects(v, cur_objects);
r->fillSelectionsBuffer(rs.cur_selections_, cl);
@@ -447,8 +449,10 @@ void RendererService::renderService() {
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
r->setUniformCamera(prog, r->view->camera());
line_object.color = QColor2QVector(Qt::white);
line_mesh_f->loadObject(f, line_object);
line_mesh_f->draw(f, 1);
line_spot_f ->loadObject(f, line_object);
line_camera_f->loadObject(f, line_object);
line_spot_f ->draw(f, 1);
line_camera_f->draw(f, 1);
//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
glEnable(GL_CULL_FACE);