scene_t * scene_add (scene_t *scene, char *id, chapter_t *parent) { if (!scene) { scene = scene_new (id, parent); return scene; } while (scene->next) scene = scene->next; scene->next = scene_new (id, parent); return scene->next; }
GtkWidget* view_new (Scene *scene, GLDrawingArea *context) { View *view = VIEW (g_object_new (view_get_type (), NULL)); GtkWidget *box, *window; view->xml = glade_xml_new (GLADEDIR "/view.glade", NULL, NULL); if (!view->xml) return NULL; box = glade_xml_get_widget (view->xml, "view vbox"); window = glade_xml_get_widget (view->xml, "window"); gtk_widget_ref (box); gtk_container_remove (GTK_CONTAINER (window), box); gtk_box_pack_start (GTK_BOX (view), GTK_WIDGET (box), TRUE, TRUE, 0); gtk_widget_unref (box); gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (context), TRUE, TRUE, 0); gtk_box_reorder_child (GTK_BOX (box), GTK_WIDGET (context), 0); if (scene == NULL) scene = scene_new (); view->scene = scene; view->context = context; g_signal_connect_after (G_OBJECT (context), "realize", G_CALLBACK (on_gl_context_realize), (gpointer) view); return GTK_WIDGET (view); }
// Initializes the scene list, the scenes, and push them into the list. void nov_scene_list_init() { on_level = __level_load_event; // Open the scene list. scene_new(); // Creates the scene nodes. day[0] = scene_data_new("Fragment #1", // Name of the chapter. _chr(game_asset_get_scene("fragment1.wmb")), // Internal name of the chapter. (scene name) NULL, // Name of the thumbnail image. NULL, // Sun color. NULL, // Fog color. NULL, // Fog range. 150.0); // Sun light intensity. day[1] = scene_data_new("Fragment #2", _chr(game_asset_get_scene("fragment2.wmb")), NULL, NULL, NULL, NULL, 150.0); day[2] = scene_data_new("Fragment #3", _chr(game_asset_get_scene("fragment3.wmb")), NULL, NULL, NULL, NULL, 150.0); day[3] = scene_data_new("Fragment #4", _chr(game_asset_get_scene("fragment4.wmb")), NULL, NULL, NULL, NULL, 150.0); day[4] = scene_data_new("Fragment #5", _chr(game_asset_get_scene("fragment5.wmb")), NULL, NULL, NULL, NULL, 150.0); day[5] = scene_data_new("Fragment #6", _chr(game_asset_get_scene("fragment6.wmb")), NULL, NULL, NULL, NULL, 150.0); day[6] = scene_data_new("Fragment #7", _chr(game_asset_get_scene("empty.wmb")), NULL, NULL, NULL, NULL, 150.0); int i = 0; for(; i < TOTAL_DAYS; i++) scene_add( day[i] ); }
static void scene_new_clicked (void) { Scene *scene = scene_new (project); project_add_scene (project, scene); project_open_scene_editor (project, scene); }
Scene* scene_from_space(const Scene* scene, const Axes* space) { Scene* r = scene_new(); r->type = SceneType_FromSpace; r->data = malloc(sizeof(FromSpaceData)); *((FromSpaceData*)r->data) = (FromSpaceData){scene, *space}; r->data_destructor_fn = from_space_data_destructor; r->ray_collision_fn = collision_ray_scene_from_space; r->is_point_in_solid_fn = scene_from_space_is_point_in_solid; return r; }
Scene* scene_half_space(const Plane* plane) { Scene* scene = scene_new(); scene->type = SceneType_HalfSpace; scene->data = malloc(sizeof(Plane)); memcpy(scene->data, plane, sizeof(Plane)); scene->data_destructor_fn = free_data_destructor; scene->ray_collision_fn = collision_ray_scene_plane; scene->is_point_in_solid_fn = scene_half_space_is_point_inside_solid; return scene; }
Scene* scene_plane(const Plane* plane) { Scene* scene = scene_new(); scene->type = SceneType_Plane; scene->data = malloc(sizeof(Plane)); memcpy(scene->data, plane, sizeof(Plane)); scene->data_destructor_fn = free_data_destructor; scene->ray_collision_fn = collision_ray_scene_plane; scene->ray_collision_fn_glsl_code = collision_ray_scene_plane_glsl_code; return scene; }
Scene* scene_empty() { Scene* scene = scene_new(); scene->type = SceneType_Empty; scene->data = 0; scene->ray_collision_fn = collision_ray_scene_empty; scene->ray_collision_fn_glsl_code = collision_ray_scene_empty_glsl_code; scene->is_point_in_solid_fn = scene_empty_is_point_in_solid; scene->is_point_in_solid_fn_glsl_code = scene_empty_is_point_in_solid_glsl_code; return scene; }
Scene* scene_invert(const Scene* scene) { Scene* r = scene_new(); r->type = SceneType_Invert; r->data = (void*)scene; r->data_destructor_fn = scene_data_destructor; r->ray_collision_fn = collision_ray_scene_invert; r->ray_collision_fn_glsl_code = collision_ray_scene_invert_glsl_code; r->is_point_in_solid_fn = scene_invert_is_point_inside_solid; r->is_point_in_solid_fn_glsl_code = scene_invert_is_point_in_solid_fn_glsl_code; return r; }
Scene* scene_sphere(const Sphere* sphere) { Scene* scene = scene_new(); scene->type = SceneType_Sphere; scene->data = malloc(sizeof(Sphere)); memcpy(scene->data, sphere, sizeof(Sphere)); scene->data_destructor_fn = free_data_destructor; scene->ray_collision_fn = collision_ray_scene_sphere; scene->ray_collision_fn_glsl_code = collision_ray_scene_sphere_glsl_code; scene->is_point_in_solid_fn = scene_sphere_is_point_in_solid; scene->is_point_in_solid_fn_glsl_code = scene_sphere_is_point_in_solid_glsl_code; return scene; }