rendering all objects belonging to each mirror
authorJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 19 Mar 2018 08:22:22 +0000 (10:22 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 19 Mar 2018 08:22:22 +0000 (10:22 +0200)
src/metascene.cc
src/renderer.cc

index eef5e65..ba5bdc2 100644 (file)
@@ -275,15 +275,17 @@ int MetaScene::calc_mirror_planes()
                                        mir->next = mirrors;
                                        mirrors = mir;
 
-                                       node = new FlatMirror;
-                                       node->wplane = mir->wplane;
-                                       node->next = planes;
+                                       // also add a node to the mirror plane matching list
+                                       FlatMirror *m = new FlatMirror;
+                                       m->wplane = mir->wplane;
+                                       m->next = planes;
                                        planes = node;
 
                                        mir->objects.push_back(obj);
                                        objmirror[obj] = mir;   // associate with object
                                        ++num_mirrors;
                                } else {
+                                       node->objects.push_back(obj);
                                        delete mir;
                                }
                        }
index b9e5884..0d23e38 100644 (file)
@@ -156,9 +156,7 @@ void Renderer::draw_object(Object *obj) const
 void Renderer::draw_mirror(FlatMirror *mir) const
 {
        push_render_target(rtmirror);
-       glClearColor(1, 0, 0, 1);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-       glClearColor(1, 1, 1, 1);
 
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();