GithubHelp home page GithubHelp logo

nim-panda3d's Introduction

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 nillable.
  • 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.

import direct/showbase
import direct/actor
import panda3d/core

var 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

nim-panda3d's People

Contributors

rdb avatar janentikan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.