I hereby claim:
- I am rdb on github.
- I am rdb (https://keybase.io/rdb) on keybase.
- I have a public key whose fingerprint is 2C05 2186 A18D E379 EEC5 C534 92F0 6704 80AD 5260
To claim this, I am signing this object:
| from panda3d.core import * | |
| from direct.showbase.ShowBase import ShowBase | |
| shader = Shader.load(Shader.SL_GLSL, "silh.vert", "silh.frag", "silh.geom") | |
| base = ShowBase() | |
| model = base.loader.loadModel("teapot.egg") | |
| model.reparentTo(base.render) | |
| model.setShader(shader) | |
| model.setRenderModeThickness(2.0) |
| # When importing a Panda class, importing everything into the namespace is considered bad style: | |
| from panda3d.bullet import * | |
| # Instead, it is better to enumerate each class specifically: | |
| from panda3d.bullet import BulletWorld, BulletDebugNode | |
| # This gets quite tedious to maintain, so it is easier to do: | |
| from panda3d import bullet | |
| w = bullet.BulletWorld() |
I hereby claim:
To claim this, I am signing this object:
| from panda3d import core, direct, physics, fx, egg | |
| import sys | |
| if len(sys.argv) > 1: | |
| classname = sys.argv[1] | |
| else: | |
| classname = input("class> ") | |
| for module in [core, direct, physics, fx, egg]: | |
| if hasattr(module, classname): |
| from panda3d.core import * | |
| #load_prc_file_data("", "gl-version 3 3") | |
| from array import array | |
| # Create two silly triangles. | |
| data = array('f', [ | |
| 0, 4, 0, | |
| 1, 4, 1, | |
| 0, 4, 1, |
| """ | |
| This example shows how to use the new Python factory function in the BamReader | |
| in order to add a custom hook that is called when the BamReader encounters an | |
| object of a certain type. | |
| You can also use this to add a custom hook whenever the bam reader loads an | |
| existing type, for example if you want to do some post-process task on every | |
| GeomNode or Material loaded from the .bam file. | |
| """ |
| // Recalculate the color. | |
| PN_stdfloat mm = 1000.0 / temperature; | |
| PN_stdfloat mm2 = mm * mm; | |
| PN_stdfloat mm3 = mm2 * mm; | |
| PN_stdfloat x, y; | |
| if (temperature < 4000) { | |
| x = -0.2661239 * mm3 - 0.2343580 * mm2 + 0.8776956 * mm + 0.179910; | |
| } else { | |
| x = -3.0258469 * mm3 + 2.1070379 * mm2 + 0.2226347 * mm + 0.240390; |
| // clang -O3 gl-preferred-format.c -o gl-preferred-format -lGL -lglut | |
| #include <stdio.h> | |
| #define GL_GLEXT_PROTOTYPES | |
| #if defined(__GNUC__) && (defined(__APPLE_CPP__) || defined(__APPLE_CC__)) | |
| #include <GLUT/glut.h> | |
| #else | |
| #include <GL/glut.h> |
| import subprocess | |
| import sys | |
| import os | |
| glsl_extensions = {'v': '.vert', 'f': '.frag', 'g': '.geom'} | |
| if len(sys.argv) != 2: | |
| print("Usage: cg2glsl.py something.sha") | |
| sys.exit(1) |
| from panda3d.core import Shader | |
| vshader = """#version 140 | |
| // Vertex inputs | |
| in vec4 p3d_Vertex; | |
| in vec2 p3d_MultiTexCoord0; | |
| // Uniform inputs | |
| uniform mat4 p3d_ModelViewProjectionMatrix; |