This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Released by rdb under the Unlicense (unlicense.org) | |
# Based on information from: | |
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt | |
import os, struct, array | |
from fcntl import ioctl | |
# Iterate over the joystick devices. | |
print('Available devices:') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Released by rdb under the Unlicense (unlicense.org) | |
# Further reading about the WinMM Joystick API: | |
# http://msdn.microsoft.com/en-us/library/windows/desktop/dd757116(v=vs.85).aspx | |
from math import floor, ceil | |
import time | |
import ctypes | |
import _winreg as winreg | |
from ctypes.wintypes import WORD, UINT, DWORD | |
from ctypes.wintypes import WCHAR as TCHAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from panda3d.core import * | |
from array import array | |
def optimize_collisions(np, *, convert_geometry=False, ignore_z=False, preserve_name=True, preserve_tags=True, track_progress=None): | |
"""Organizes all "into" collision nodes below this level into an octree or | |
quadtree (actually an AABB tree, but never mind that) for greatly speeding | |
up collisions. | |
If convert_geometry is True, also converts all GeomNodes (unless you set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from panda3d.core import CharacterJoint, CharacterSlider, CharacterVertexSlider | |
from panda3d.core import AnimBundle, AnimGroup, AnimChannelScalarDynamic | |
from panda3d.core import AnimChannelMatrixXfmTable, AnimChannelScalarTable | |
from panda3d.core import PTA_float | |
class MotionCapture: | |
def __init__(self, actor, part_name="modelRoot", lod_name="lodRoot"): | |
self.part_bundle = actor.get_part_bundle(part_name, lod_name) | |
self.joint_tables = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from panda3d.core import Shader | |
vshader = """#version 140 | |
// Vertex inputs | |
in vec4 p3d_Vertex; | |
in vec2 p3d_MultiTexCoord0; | |
// Uniform inputs | |
uniform mat4 p3d_ModelViewProjectionMatrix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MSGTYPE_DATAGRAM = 0; | |
const MSGTYPE_HELLO = 1; | |
const MSGTYPE_DEFINE_COLLECTORS = 2; | |
const MSGTYPE_DEFINE_THREADS = 3; | |
/** | |
* Contains a single collector definition as sent by the client. | |
*/ | |
class CollectorDef { | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from panda3d.core import * | |
from random import random | |
num_points = 100000 | |
vdata = GeomVertexData('points', GeomVertexFormat.get_v3(), GeomEnums.UH_static) | |
vdata.set_num_rows(num_points) | |
vertex = GeomVertexWriter(vdata, 'vertex') | |
for i in range(num_points): |
NewerOlder