warning

C3D while it has been released there may still be instabilities that i am not aware off! if you find any please contact me so they can be resolved.

discord: 9551Dev#5787

C3D is an advanced 3D Renderer for ComputerCraft. It provides the ability to load .obj files and apply textures.

How to download: wget run https://github.com/9551-Dev/C3D/raw/master/installer.lua

actual usage:

local C3D = require("c3d")
C3D.run(function()
    -- awesome code
end)

Examples will be found in the examples directory, currently still working on them.

3D shrek model with a texture

Modules

c3dThis is not really an module but functions directly attached to the c3d table
c3d.cameraThe camera module is used for working around with camera objects and the scenes camera
c3d.eventThe event module is mainly used internally for sharing data across the engine.
c3d.geometryThe geometry module is used for getting default basic shapes.
c3d.graphicsThe graphics module is used for image and rendering settings related things, such as texture loading and starting frame ...
c3d.interactThe interact module allows you to get things from the 3D scene from screen coordinates.
c3d.keyboardThe keyboard module is used for checking for inputs and interactions from the user
c3d.logThe log module can be used to interact with the C3D log which is saved in libC3D/c3d.
c3d.meshGoes along the raw mesh object.
c3d.mousethe mouse module is used for getting inputs from the mouse.
c3d.palette(module)Module to go along with the palette object
c3d.perspectivethe perspective module is used for manipulating the cameras perspective in the scene
c3d.pipethe pipe module is used to modify and manipulate the rendering pipeline by adding or changing functions inside of it
c3d.pluginthe plugin module can be used to load plugins and do thing with them.
c3d.registrythe registry module is ment to be used by plugins for getting registries and making new entires
c3d.scenethe scene module is used for changing things in the 3D scene and adding new geometries
c3d.shaderthe shader module provides a bunch of tools for creating your own custom shaders and also the default shaders so they ca...
c3d.sysfew C3D system related functions
c3d.threadthe thread module is used for multitasking and sharing data across "channels" IMPORTANT: you can use the threaderror cal...
c3d.timera bunch of FPS and time related things
c3d.vectorthe vector library adds a bunch of common vector operations along with metatable methods to make them convinient.

Callbacks

c3d.errorhandlerA callback function which gets ran when your program causes an exception.
c3d.initSpecial callback dedicated to modifying things before C3D itself inicializes.
c3d.loadA function that gets ran the moment the main loop of the 3D engine starts you can use it to load assets/models/generate ...
c3d.on_eventA function that gets ran when an event is fired within CraftOS and gets provided with the unpacked event data.
c3d.postrenderThis callback function can be used to draw some overlay on top of the rendered screen.
c3d.quitUsed for detecting when the user tries to quit the application by terminating it using the Ctrl+T shortcut.
c3d.renderThis function gets called right before the 3D scene is drawn but after the 3D engine finishes a frame.
c3d.runThe default main loop that the library uses for frame updates.
c3d.screen_renderAllows you to set your own way of drawing the rendered scene to the screen.
c3d.threaderrorThis callback is called when a thread object from the thread module thread object has an exception happen.
c3d.updateThis callback should be used for updating the sceene and states of it.

Event-Callbacks

c3d.keypressedA callback function which gets called when you press key on the keyboard or when you have the key held down this gets tr...
c3d.keyreleasedHappens when a keyboard key has been released.
c3d.mousemovedThis callback is a bit more complicated.
c3d.mousepressedA callback function which gets ran when any mouse button is pressed you can also easily use it to handle things like dou...
c3d.mousereleasedA callback function triggered when the user releases a pressed mouse button i terms of arguments and how it works it is ...
c3d.on_eventA function that gets ran when an event is fired within CraftOS and gets provided with the unpacked event data.
c3d.resizeCallback that gets fired when a change in the terminal size is detected.
c3d.textinputA really simple callback function for when characters are pressed.
c3d.wheelmovedA callback function which gets ran when you scroll the mouse wheel.

Object

animated_texturethe methods for the animated_texture object
camera_objectthe methods for the camera object
generic_shapedefinition of a 3D geometry along with some methods
imported_modelthe object you get when you import a model from a model file.
materialallows you to load and decode .
palettethe palette object is used by the image library to apply quantized palettes using tail calls.
pluginThe plugin object is what you get when you create a new plugin in C3D.
raw_meshthe raw_mesh object is a convinient tool for making optimized meshes for C3D.
registry_entrysimple object used for identifying entries within registries.
scene_objectThe scene object is used to interact with the 3D models in the scene.
sprite_sheetthe methods for the sprite_sheet object
texturea loaded texture object.

Examples

example.shadershaders can be quite tricky but are very powerful once you learn to use them.
example.texturinghere i will show how to put the CC:T logo (https://tweaked.cc/pack.png) on a spinning cube
example.threadthe thread library is meant to be used for multitasking and sending data across your program using channels.

Misc

enabling_debuga small showcase of how to enable the C3D debug mode
geometry_flagsthere are several flags you can asign to your geometry, here is a list of them
sprite_sheet_settingsthere are several flags you can asign to your geometry, here is a list of them
texture_load_settingsThe settings used when loading images using the graphics module
triangle_tableThis lists the fields that the internals of the engine use for storing triangles.

Plugin

callbacksA list of all the callbacks provided by the plugin api for you to use to integrate your plugin deeper into C3D
introductiona guide to show how to setup a basic plugin