Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rdb/nim-panda3d
Proof of concept nim binding for Panda3D
https://github.com/rdb/nim-panda3d
nim nim-lang nim-language panda3d panda3d-game-engine
Last synced: about 1 month ago
JSON representation
Proof of concept nim binding for Panda3D
- Host: GitHub
- URL: https://github.com/rdb/nim-panda3d
- Owner: rdb
- Created: 2022-05-06T14:48:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-13T15:33:17.000Z (about 1 year ago)
- Last Synced: 2024-11-04T03:40:44.688Z (3 months ago)
- Topics: nim, nim-lang, nim-language, panda3d, panda3d-game-engine
- Language: Nim
- Homepage: https://www.panda3d.org/
- Size: 4.87 MB
- Stars: 8
- Watchers: 1
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a proof of concept nim binding for Panda3D.
There is a subset of the DIRECT API implemented as well. It is deliberately
incomplete, only the parts that can't be trivially reimplemented using the C++
API are intended to be supported.Some things to keep in mind:
* Reference-counted types like PandaNode are always by-ref, using Panda's
reference counting system, just like in Python. To create an instance, use
something like `newPandaNode()`. These types are `nil`lable.
* Other types, like NodePath, are stored by-value. Create instances using
`initNodePath()` and the like.
* The typical code convention in nim is camelCase, but snake_case is supported
as well by virtue of how nim's identifier resolution works.
* Both property interfaces and getter/setter methods are supported.
* Tuples are accepted in place of vectors, but be sure that the types of the
elements are correct.
* The ShowBase constructor doesn't open a window. Call `openDefaultWindow()`.
* The `direct` modules are woefully incomplete, see above.Here is a brief example, see `test.nim` for the complete Hello World tutorial.
```nim
import direct/showbase
import direct/actor
import panda3d/corevar base = ShowBase()
base.openDefaultWindow()var env = loader.loadModel("models/environment")
env.reparentTo(render)
env.setScale(0.25, 0.25, 0.25)
env.setPos(-8, 42, 0)var pandaActor = Actor()
pandaActor.loadModel("models/panda-model")
pandaActor.loadAnims({"walk": "models/panda-walk4"})
pandaActor.setScale(0.005, 0.005, 0.005)
pandaActor.reparentTo(render)
pandaActor.loop("walk")base.run()
```Building the example:
```
make test
./test
```