Skip to content

Commit

Permalink
Updating readme, go.mod.
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarLune committed Dec 13, 2022
1 parent b847038 commit 3bcc28c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 51 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.18

require (
github.com/hajimehoshi/ebiten/v2 v2.4.8
github.com/kvartborg/vector v0.1.2
github.com/qmuntal/gltf v0.23.1
golang.org/x/image v0.1.0
)
Expand Down
13 changes: 1 addition & 12 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/ebitengine/purego v0.0.0-20220905075623-aeed57cda744 h1:A8UnJ/5OKzki4HBDwoRQz7I6sxKsokpMXcGh+fUxpfc=
github.com/ebitengine/purego v0.0.0-20220905075623-aeed57cda744/go.mod h1:Eh8I3yvknDYZeCuXH9kRNaPuHEwvXDCk378o9xszmHg=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220806181222-55e207c401ad h1:kX51IjbsJPCvzV9jUoVQG9GEUqIq5hjfYzXTqQ52Rh8=
Expand All @@ -9,8 +7,6 @@ github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg=
github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/hajimehoshi/bitmapfont/v2 v2.2.1 h1:y7zcy02/UgO24IL3COqYtrRZzhRucNBtmCo/SNU648k=
github.com/hajimehoshi/bitmapfont/v2 v2.2.1/go.mod h1:wjrYAy8vKgj9JsFgnYAOK346/uvE22TlmqouzdnYIs0=
github.com/hajimehoshi/ebiten/v2 v2.4.3 h1:swJS611Z9R1NVTSGJVq6nIAwLr3fNlT3nkcfhNI3H9c=
github.com/hajimehoshi/ebiten/v2 v2.4.3/go.mod h1:Ofk1EfQZZ8tL0TlEPF5wPrnN+8Oa/ywuQOYh+uYsqLQ=
github.com/hajimehoshi/ebiten/v2 v2.4.8 h1:rrSfpkCdx5sHVL72c8CF6TRz2BfttbhBT3yMCqa1IIo=
github.com/hajimehoshi/ebiten/v2 v2.4.8/go.mod h1:Ofk1EfQZZ8tL0TlEPF5wPrnN+8Oa/ywuQOYh+uYsqLQ=
github.com/hajimehoshi/file2byteslice v0.0.0-20210813153925-5340248a8f41 h1:s01qIIRG7vN/5ndLwkDktjx44ulFk6apvAjVBYR50Yo=
Expand All @@ -23,13 +19,7 @@ github.com/jezek/xgb v1.0.1 h1:YUGhxps0aR7J2Xplbs23OHnV1mWaxFVcOl9b+1RQkt8=
github.com/jezek/xgb v1.0.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
github.com/jfreymuth/oggvorbis v1.0.4/go.mod h1:1U4pqWmghcoVsCJJ4fRBKv9peUJMBHixthRlBeD6uII=
github.com/jfreymuth/vorbis v1.0.2/go.mod h1:DoftRo4AznKnShRl1GxiTFCseHr4zR9BN3TWXyuzrqQ=
github.com/kvartborg/vector v0.1.1 h1:I6/JrRN245Mh06jv4JIVFzhzD+cLq80b1SjzbU9rI24=
github.com/kvartborg/vector v0.1.1/go.mod h1:GAX7tMJqXx9fB1BrsTWPOXy6IBRX+J461BffVPAdpwo=
github.com/kvartborg/vector v0.1.2 h1:HjdGr/4SVlQ7xCI6k3pvKWPdsXOCev1mS5vIueNZ99A=
github.com/kvartborg/vector v0.1.2/go.mod h1:GAX7tMJqXx9fB1BrsTWPOXy6IBRX+J461BffVPAdpwo=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/qmuntal/gltf v0.22.1 h1:SzH/OQJa04iYOlJQTG/3aqnuj6GGGtOqX2Wi55q3+dw=
github.com/qmuntal/gltf v0.22.1/go.mod h1:7FR0CRHoOehIgKTBVq/QVyvPn0i6tzp2AdIghb2bPg4=
github.com/qmuntal/gltf v0.23.1 h1:R8vkbJXmARbD/oI+Yn3252I2qDQ8mljsc88BJJEdYMY=
github.com/qmuntal/gltf v0.23.1/go.mod h1:7FR0CRHoOehIgKTBVq/QVyvPn0i6tzp2AdIghb2bPg4=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
Expand All @@ -43,7 +33,6 @@ golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 h1:estk1glOnSVeJ9tdEZZc5mAMD
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 h1:/eM0PCrQI2xd471rI+snWuu251/+/jpBpZqir2mPdnU=
golang.org/x/image v0.0.0-20220722155232-062f8c9fd539/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk=
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=
Expand Down Expand Up @@ -82,8 +71,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
Expand Down
71 changes: 33 additions & 38 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

[Ebitengine Discord](https://discord.gg/fXM7VYASTu)

![Tetra3D Logo](https://thumbs.gfycat.com/DifferentZealousFowl-size_restricted.gif)
[SolarLune's Discord](https://discord.gg/cepcpfV)

![Tetra3D Logo](https://user-images.githubusercontent.com/4733521/207243838-b3ece6c4-965a-4cb5-aa81-b6b61f34d4d4.gif)

![It Breeds Fear - Construction Worker](https://thumbs.gfycat.com/ThoughtfulChubbyBunny-size_restricted.gif)

Expand All @@ -22,8 +24,6 @@ Tetra3D is a 3D hybrid software / hardware renderer written in Go by means of [E

Tetra3D's rendering evokes a similar feeling to primitive 3D game consoles like the PS1, N64, or DS. Being that a largely-software renderer is not _nearly_ fast enough for big, modern 3D titles, the best you're going to get out of Tetra is drawing some 3D elements for your primarily 2D Ebitengine game, or a relatively simple fully 3D game (i.e. something on the level of a PS1, or N64 game). That said, limitation breeds creativity, and I am intrigued at the thought of what people could make with Tetra.

In general, Tetra3D's just a renderer, so you can target higher resolutions (like 1080p or 4K) _or_ lower resolutions. Anything's fine as long as the target GPU can handle generating the color and depth textures at your desired resolution (assuming you have depth texture rendering on).

Tetra3D also gives you a Blender add-on to make the Blender > Tetra3D development process flow a bit smoother. See the Releases section for the add-on, and [this wiki page](https://github.com/SolarLune/Tetra3d/wiki/Blender-Addon) for more information.

## Why did I make it?
Expand All @@ -42,7 +42,7 @@ Because it's like a [tetrahedron](https://en.wikipedia.org/wiki/Tetrahedron), a

`go get github.com/solarlune/tetra3d`

Tetra depends on kvartborg's [vector](https://github.com/kvartborg/vector) package, and [Ebitengine](https://ebiten.org/) itself for rendering. Tetra3D requires Go v1.16 or above. This minimum required version is somewhat arbitrary, as it could run on an older Go version if a couple of functions (primarily the ones that loads data from a file directly) were changed.
Tetra depends on [Ebitengine](https://ebiten.org/) itself for rendering. Tetra3D requires Go v1.16 or above. This minimum required version is somewhat arbitrary, as it could run on an older Go version if a couple of functions (primarily the ones that loads data from a file directly) were changed.

There is an optional Blender add-on as well (`tetra3d.py`) that can be downloaded from the releases page or from the repo directly (i.e. click on the file and download it). The add-on provides some useful helper functionality that makes using Tetra3D simpler - for more information, check the [Wiki](https://github.com/SolarLune/Tetra3d/wiki/Blender-Addon).

Expand All @@ -65,9 +65,6 @@ import (
"github.com/hajimehoshi/ebiten/v2"
)

const ScreenWidth = 786
const ScreenHeight = 448

type Game struct {
GameScene *tetra3d.Scene
Camera *tetra3d.Camera
Expand Down Expand Up @@ -108,10 +105,8 @@ func NewGame() *Game {
// g.Camera = tetra3d.NewCamera(ScreenWidth, ScreenHeight)

// However, we can also just grab an existing camera from the scene if it
// were exported from the GLTF file. The loading options struct speciies the camera's
// backing texture size (defaulting to 1920x1080 if either
// no loading options are passed, or the default loading options struct is used
// unaltered).
// were exported from the GLTF file - if exported through Blender's Tetra3D add-on,
// then the camera size can be set from within Blender.

g.Camera = g.GameScene.Root.Get("Camera").(*tetra3d.Camera)

Expand All @@ -120,22 +115,21 @@ func NewGame() *Game {
// Models, Lights, and Nodes (which are essentially "empties" one can
// use for positioning and parenting) can, as well.

// We can place Models, Cameras, and other Nodes with node.SetWorldPositionVec() or
// node.SetLocalPositionVec(). Both functions take a 3D Vector from kvartborg's
// vector package, and there's an additional variant that just takes the components directly,
// for convenience.
// We can place Models, Cameras, and other Nodes with node.SetWorldPosition() or
// node.SetLocalPosition(). There are also variants that take a 3D Vector.

// The *World variants position Nodes in absolute space; the Local variants
// position Nodes relative to their parents' positioning and transforms (and is
// more performant.)
// The *World variants of positioning functions takes into account absolute space;
// the Local variants position Nodes relative to their parents' positioning and
// transforms (and is more performant.)
// You can also move Nodes using Node.Move(x, y, z) / Node.MoveVec(vector).

// Each Scene has a tree that starts with the Root Node. To add Nodes to the Scene,
// parent them to the Scene's base, like so:

// g.GameScene.Root.AddChildren(object)
// scene.Root.AddChildren(object)

// To remove them, either use Node.RemoveChildren() or Node.Unparent().
// To remove them, either use Node.RemoveChildren() (in this case, scene.Root.RemoveChildren())
// or Node.Unparent() (in this case, object.Unparent() ).

// For Cameras, we don't actually need to have them in the scene to view it, since
// the presence of the Camera in the Scene node tree doesn't impact what it would see.
Expand All @@ -160,10 +154,10 @@ func (g *Game) Draw(screen *ebiten.Image) {
// Below, we'll pass both the Scene and the scene root because 1) the Scene influences
// how Models draw (fog, for example), and 2) we may not want to render all Models.

// Camera.RenderNodes() renders all Nodes in a tree, starting with the
// Node specified. You can also use Camera.Render() to simply render a selection of
// individual Models.
g.Camera.RenderNodes(g.GameScene, g.GameScene.Root)
// Camera.RenderScene() renders all Nodes in a scene, starting with the
// scene's root. You can also use Camera.Render() to simply render a selection of
// individual Models, or Camera.RenderNodes() to render a subset of a scene tree.
g.Camera.RenderScene(g.GameScene)

// Before drawing the result, clear the screen first; in this case, with a color, though we
// can also go with screen.Clear().
Expand All @@ -176,11 +170,11 @@ func (g *Game) Draw(screen *ebiten.Image) {
}

func (g *Game) Layout(w, h int) (int, int) {
// This is the size of the window; note that we set it
// to be the same as the size of the backing camera texture. However,
// you could use a much larger backing texture size, thereby reducing
// certain visual glitches from triangles not drawing tightly enough.
return ScreenWidth, ScreenHeight
// Here, by simply returning the camera's size, we are essentially
// scaling the output to the window size and letterboxing as necessary.
// If you wanted to extend the camera view according to window size, you would
// have to resize the camera using the new width and height.
return g.Camera.Size()
}

func main() {
Expand Down Expand Up @@ -211,10 +205,10 @@ func NewGame() *Game {

g := &Game{}

// Create a new BoundingCapsule, 1 unit tall with a 0.25 unit radius for the caps at the ends.
// Create a new BoundingCapsule named "player", 1 unit tall with a 0.25 unit radius for the caps at the ends.
g.Capsule = tetra3d.NewBoundingCapsule("player", 1, 0.25)

// Create a new BoundingAABB, of 0.5 width, height, and depth (in that order).
// Create a new BoundingAABB named "block", of 0.5 width, height, and depth (in that order).
g.Cube = tetra3d.NewBoundingAABB("block", 0.5, 0.5, 0.5)

// Move it over on the X axis by 4 units.
Expand All @@ -236,9 +230,9 @@ func (g *Game) Update() {

```

That's basically it.
If you wanted a deeper collision test with multiple objects, you can do so using `IBoundingObject.CollisionTest()`. Take a look at the [Wiki](https://github.com/SolarLune/tetra3d/wiki/Collision-Testing) and the `bounds` example for more info.

Note that Tetra3D is, indeed, a work-in-progress and so will require time to get to a good state. But I feel like it works pretty well as is. Feel free to examine the examples folder for some examples showing how Tetra3D works. Calling `go run .` from within their directories should work.
That's basically it. Note that Tetra3D is, indeed, a work-in-progress and so will require time to get to a good state. But I feel like it works pretty well as is. Feel free to examine all of the examples in the `examples` folder. Calling `go run .` from within their directories will run them - the mouse usually controls the view, and clicking locks and unlocks the view.

There's a quick start project repo available [here](https://github.com/SolarLune/tetra3d-quickstart), as well to help with getting started.

Expand Down Expand Up @@ -308,13 +302,13 @@ The following is a rough to-do list (tasks with checks have been implemented):
- [X] -- Collection / group substitution
- [X] -- -- Overwriting properties through collection instance
- [ ] -- -- (Not done as well as I would like currently; ideally, you can view and manually override each individual property of top-level objects in the collection?)
- [ ] -- Optional camera size export
- [x] -- Optional camera size export
- [X] -- Linking collections from external files
- [X] -- Material data export
- [X] -- Option to pack textures or leave them as a path
- [X] -- Path / 3D Curve support
- [X] -- Grid support (for pathfinding / linking 3D points together)
- [ ] -- Toggleable option for drawing property status to screen for each object using the gpu and blf modules
- [ ] -- Toggleable option for drawing game property status to screen for each object using the gpu and blf modules
- [X] **DAE model loading**
- [X] -- Vertex colors loading
- [X] -- UV map loading
Expand Down Expand Up @@ -354,11 +348,11 @@ The following is a rough to-do list (tasks with checks have been implemented):

- [ ] **3D Sound** (adjusting panning of sound sources based on 3D location)
- [ ] **Optimization**
- [ ] -- Reusing vertex indices for adjacent triangles (I believe this is possible to implement; I didn't initially because I thought that would make adjacent triangles, each with their own UV values impossible; in truth, the modeler probably automatically splits these vertices out into unique ones as necessary)
- [x] -- Reusing vertex indices for adjacent triangles
- [ ] -- Multithreading (particularly for vertex transformations)
- [X] -- Armature animation improvements?
- [ ] -- Replace Vector usage with struct-based custom vectors (that aren't allocated to the heap or reallocated unnecessarily, ideally)?
- [X] -- Vector pools
- [X] -- Custom Vectors
- [ ] -- Matrix pools?
- [ ] -- Instead of doing collision testing using triangles directly, we can test against planes / faces if possible to reduce checks?
- [ ] -- Lighting speed improvements
Expand All @@ -370,7 +364,8 @@ Again, it's incomplete and jank. However, it's also pretty cool!

Huge shout-out to the open-source community:

- StackOverflow, in general
- StackOverflow, in general, _FOR REAL_
- [quartercastle's vector package](https://github.com/quartercastle/vector)
- [fauxgl](https://github.com/fogleman/fauxgl)
- [tinyrenderer](https://github.com/ssloy/tinyrenderer)
- [learnopengl.com](https://learnopengl.com/Getting-started/Coordinate-Systems)
Expand Down

0 comments on commit 3bcc28c

Please sign in to comment.