Skip to content

Instantly share code, notes, and snippets.

#Panda3D input polling interface idea
# When a keyboard/controller/mouse button is pressed/released/moved
# the values in base.inputs is updated.
# The keys are {device_name}-{button_name}
# The values for buttons are 1 or 0
forward = 'keyboard-w'
if base.inputs[forward]:
self.pc.set_y(self.pc, dt*move_speed)
"""
The FilterManager is a convenience class that helps with the creation
of render-to-texture buffers for image postprocessing applications.
Still need to implement:
* Make sure sort-order of buffers is correct.
* Matching buffer size to original region instead of original window.
* Intermediate layer creation.
I presume the sliders go from-1.0 to 1.0,
left_trigger is listed two times, left_trigger* is the second from the top
left_x and left_y rest at ~0.0, right_trigger, left_trigger and left_trigger*, rest ~0.25
'digital' mode:
device_tester.py html5gamepad.com actual button is ok?
left_y(1.0) axis1 (-1.0) d-pad up Yes
left_x(-1.0) axis0 (-1.0) d-pad left Yes
left_y(1.0) axis1 (1.0) d-pad down Yes
left_x(1.0) axis0 (1.0) d-pad right Yes
PS C:\Basis Software Platform> py -3 setup.py build_apps
running build_apps
Building platforms: manylinux1_x86_64,manylinux1_i686,win32,win_amd64
Gathering wheels for platform: manylinux1_x86_64
Collecting panda3d==1.10.0.dev1511+deployng.222 (from -r ./requirements.txt (line 2))
File was already downloaded c:\basis software platform\build\__whl_cache__\panda3d-1.10.0.dev1511+deployng.222-cp36-cp
36m-manylinux1_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: manylinux1_x86_64
There are some missing modules: ['__builtin__']
from panda3d.core import *
from direct.interval.IntervalGlobal import *
seq=Sequence(Wait(5.0), Wait(1.0))
print(seq.get_duration())
print(seq)
print(seq.get_duration())
@wezu
wezu / terrain_tex_f.glsl
Created May 24, 2018 07:17
Fragment shader for Shader Terrain Mesh using 4 detail textures
#version 150
// This is the terrain fragment shader. There is a lot of code in here
// which is not necessary to render the terrain, but included for convenience -
// Like generating normals from the heightmap or a simple fog effect.
// Most of the time you want to adjust this shader to get your terrain the look
// you want. The vertex shader most likely will stay the same.
// ADDED TEXTUR SPLATTING!
@wezu
wezu / drag_and_drop.py
Last active May 11, 2018 10:15
Panda3D Drag & Drop Demo
'''
Drag & Drop Demo
Use the mouse to drag and drop colored squares from moving frames or the background.
Use left mouse click to grab a square, release it to ...well, release it.
'''
from panda3d.core import *
from direct.gui.DirectGui import *
from direct.showbase import ShowBase
from direct.interval.LerpInterval import LerpPosInterval
from direct.interval.MetaInterval import Sequence
from panda3d.core import *
from random import uniform
import sys
import bisect
if sys.version_info >= (3, 3):
from time import perf_counter as timer
else:
if sys.platform == "win32":
from time import clock as timer
else:
from panda3d.core import *
load_prc_file_data('','bullet-filter-algorithm groups-mask')
from panda3d.bullet import *
from direct.showbase.DirectObject import DirectObject
from direct.showbase import ShowBase
class App(DirectObject):
def __init__(self):
#init panda3d showbase
base = ShowBase.ShowBase()
@wezu
wezu / controller.py
Created February 4, 2018 13:15
Joystick support for P3D (windows olny)
# Original release by rdb under the Unlicense (unlicense.org)
# Modified by wezu
from __future__ import print_function
from math import floor, ceil
import time
import ctypes
from ctypes.wintypes import WORD, UINT, DWORD
from ctypes.wintypes import WCHAR as TCHAR
from direct.showbase.DirectObject import DirectObject