{"id":20127399,"url":"https://github.com/buserror/libc3","last_synced_at":"2025-09-03T14:33:40.425Z","repository":{"id":3503748,"uuid":"4560776","full_name":"buserror/libc3","owner":"buserror","description":"Lightweight C Scene Graph Library","archived":false,"fork":false,"pushed_at":"2012-06-26T13:35:01.000Z","size":236,"stargazers_count":33,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-26T12:46:30.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buserror.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-05T14:08:10.000Z","updated_at":"2025-04-15T18:10:38.000Z","dependencies_parsed_at":"2022-09-14T12:51:54.927Z","dependency_job_id":null,"html_url":"https://github.com/buserror/libc3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buserror%2Flibc3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buserror%2Flibc3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buserror%2Flibc3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buserror%2Flibc3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buserror","download_url":"https://codeload.github.com/buserror/libc3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252744497,"owners_count":21797632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T20:21:02.440Z","updated_at":"2025-05-06T18:31:34.725Z","avatar_url":"https://github.com/buserror.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"**libc3** - No frill 'scene' graph library in C\n=====\n(C) 2012 Michel Pollet \u003cbuserror@gmail.com\u003e\n\n**WARNING** This API is not your nanny. It is made to be lean, mean, efficient\nwith no frill, no asserts, no bounds checking, no sugar coating.\n\nOn the other hand it's fast, reasonably clean and is a micro-fraction of the\nother giganormous 'scene graphs' or 'game engine' libraries around.\n\nIt's vaguely inspired by THREE.js funnily enough, because it allows you to\nhack around and quickly get stuff on screen with the minimal amount of \neffort.\n\nIntroduction\n-----------\nThe general idea is that the library keeps track of geometry and stuff, but doesn't\ndo *any* opengl or related calls. Instead, it uses callbacks into code that will\ntake care of the rendering related tasks.\n\nSo for example a c3pixels represents a texture, but a callback into the rendering\nlayer will be responsible to push the pixels to OpenGL, and store the object back\ninto the c3pixels for reference.\n\nStatus\n-------\nThe API is generally functional, but it's brand new. I try not to add bits that\nI aren't needed, and I also don't add stuff that isn't tested.\n\nThere is an ASCII STL file loader that works, and a few other bit of geometry related\nhelpers. \n\nIt's currently used in one 'serious' project and also in my [3D printer simulator](https://github.com/buserror-uk/simreprap). \nlibc3 also builds a companion library called *libc3-gl* that implements a default OpenGL\nrenderer 'driver' as a set of callbacks.  *libc3-gl* does the 'dirty' work for loading\nshaders, creating and maintaining frame buffer objects, vertex buffer objects etc.\n\nGeneral Roadmap\n---------------\nThere is a [PDF Flowchart](https://github.com/buserror-uk/libc3/raw/master/doc/libc3-flowchart.pdf) \nof how things are mostly organized as far as data structure goes, but the following is a\nbreakdown of the major components.\n\nThe API has various bits:\n* c3algebra: C derivative of an old C++ piece of code I had lying around and that has\nbeen present in my toolset for a long time. It gives you *vectors* (c3vec2, c3vec3, c3vec4)\nand *matrices* (c3mat3, c3mat4) with various tools to manipulate them.\n* c3quaternion: Quaternion implementation using c3algebra\n* c3camera/c3arcball: camera manipulation bits\n\nThe basic data structure is as follow:\n* *c3context*:\n\tHosts a \"root\" object, and a list of 'viewpoints' (ie either cameras, or lights).\n\tit can reproject the objects \u0026 geometries, and call the callbacks to draw them.\n\t\n\tThe context also keeps a list of *c3pixels* and *c3program* that are referenced\n\tby the geometries.\n* *c3object*: \n\t* Has a list of (sub) c3objects\n\t* Has a list of c3transforms (ie matrices)\n\t* Has a list of c3geometry (ie real vertices and stuff)\n  The object is a container for other objects, and for geometry itself. Objects don't\n  necessary have geometry and/or sub objects, and don't even need transforms if their\n  vertices are already projected.\n* *c3geometry*:\n\t* Has a 'type' (raw for simple vertices, texture, triangles etc)\n\t* Has a 'subtype' (mostly can be used to draw GL types)\n\t* Has a 'material' (ie color, texture, a GPU program... to be completed)\n\t* Has a list of vertices\n\t* Has a list of texture coordinates (optional)\n\t* Has a list of vertices colors (optional)\n\t* Had a list of vertices indexes (optional)\n* *c3transform*:\n\tIs just a sugar coated matrix, with an optional name.\n\nAlso there are:\n* *c3pixels*:\n\tIs just a wrapper/holder for some pixels, either allocated, or inherited, \n\tit's mostly used for *c3texture*\n* *c3texture*:\n\tAssociates a *c3geometry* with a *c3pixels* and has a standard Quad\n\tfor vertices. The OpenGL drawing is not done there, it's done by the application using\n\tthe generic *c3context* driver.\n* *c3cairo*:\n\tPlaceholder for now, inherits from *c3texture* and will contain a\n\tcairo surface mapped to a GL texture.\n* *c3light*:\n\tSource of light, as a hidden geometry do it get transformed like a normal\n\tone. Right now the implementation uses glLight unless there is a shader\n\tinstalled.\n\t\nDraw Drivers \"Inheritance\"\n------------\nVarious object uses static tables of callbacks to implement their behaviours\nit's kinda cheap c++ inheritance, without the usual bloat.\n\nThere just a couple macros to call the driver chain for a particular function call.\nThe relevant bits are in c3driver*.h.\n\nMostly the code looks for a matching callback in a static table, and call it if found.\nIf that callback wants, it can also call the inherited object callback too.\n\nDirtyness\n---------\nThere is a notion of 'dirtyness' in the tree, when you touch a *c3transform*, and/remove\nobjects and geometry, a dirty bit is propagated up the tree of object. This tells the\nrendering it needs to reproject the dirty bits and repopulate the projected vertice\ncache.\n\nThe 'dirty' bit moves both ways, when setting a dirty bit to true, it propagates upward,\nwhen you set it to false, it propagates downward in the tree.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuserror%2Flibc3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuserror%2Flibc3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuserror%2Flibc3/lists"}