Light *Node::light_create(Scene &scene, const unsigned int lamp_type, const unsigned int illumination_type) { Assets &assets = scene.assets_get(); Stock_Nodes &stock_nodes = assets.stock_nodes_get(); Node *node_ptr = nullptr; if (illumination_type == Light::GLOBAL) { node_ptr = stock_nodes.screen_quad_get(); } else { node_ptr = stock_nodes.sphere_get(); } if (!node_ptr) { std::cout << "Error: Light type was not set" << std::endl; return nullptr; } std::unique_ptr<Light> light(new Light()); Light *light_ptr = light.get(); light_ptr->properties_type_set(lamp_type); light_ptr->illumination_type_set(illumination_type); mesh_set(node_ptr->mesh_get()); light_set(light_ptr); auto plugins = scene.plugins_get(); for (auto &plugin : plugins) { plugin->cb_light_create(this); } assets.light_active_add(std::move(light)); return light_ptr; }
void view_render (View *view) { RenderState *rstate = render_state_new (); gint i; gl_drawing_area_make_current (view->context); glClearColor (0.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera_load (view->camera); for (i = 0; i < view->nlights; i++) light_set (view->lights[i]); scene_render (view->scene, rstate); gl_drawing_area_swap_buffers (view->context); g_object_unref (rstate); }