Skip to content

Instantly share code, notes, and snippets.

@croxis
croxis / cgui.py
Last active December 14, 2015 21:59
Attempt at combining bpython with panda3d. Currently does not show input until enter is pressed.
## Overrides for bpython to work under panda's loop and modified urwid ##
import os
import urwid
from urwid.display_common import INPUT_DESCRIPTORS_CHANGED
# urwid overrides to work with Panda3D's task system #
class PandaEventLoop(urwid.SelectEventLoop):
@croxis
croxis / mc
Last active December 15, 2015 21:29
--[[
computer_0 mission control
monitor_1 monitor
computer_2 force field generator
MISSION CONTROL
--]]
--[[monitor = peripheral.wrap('left')
@croxis
croxis / mc2
Last active December 15, 2015 21:38
mc2
--[[
computer_0 mission control
monitor_1 monitor
computer_2 force field generator
MISSION CONTROL LAUNCH WARNING
--]]
print("Starting mission control launch warning system")
modem = peripheral.wrap('right')
2013-04-14 20:10:56 [INFO] [ForgeModLoader] Forge Mod Loader version 5.1.21.651 for Minecraft 1.5.1 loading
2013-04-14 20:10:56 [INFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_09, running on Windows 8:amd64:6.2, installed at C:\Program Files\Java\jre7
2013-04-14 20:10:56 [FINE] [ForgeModLoader] Java classpath at launch is C:\Users\croxis\Desktop\TechnicLauncher.exe
2013-04-14 20:10:56 [FINE] [ForgeModLoader] Java library path at launch is C:\Program Files\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel
@croxis
croxis / urwidp3d.py
Created May 3, 2013 19:45
Urwid based console interface for panda3D
'''Panda3D urwid interface
Version 1
Authors: croxis
This is an example of a command line curses style gui for Panda3D.
It uses urwid for graphical widgets and bpython for the python console.
This sample creates 3 windows. The first is for controlling the application
though text commands (ie, like a minecraft server). In this example text
is just reposted to the output.
@croxis
croxis / shapeGenerator.py
Created May 14, 2013 20:19
Files for bug test. Arch linux 64 with nvidia 660 ti.
from pandac.PandaModules import NodePath, GeomVertexFormat, GeomVertexWriter, \
GeomVertexData, Geom, GeomTriangles, GeomNode
# ------------------------------------------------------------------------------
# GEOMETRY DATA GENERATORS
# ------------------------------------------------------------------------------
import math
class GeometryData:
def __init__(self):
[9761.156] EconomicGeneralInfo: Total Units - 2
[9761.156] EconomicGeneralInfo: Maint Free Units - 0
[9761.156] EconomicGeneralInfo: Paid Units - 2
[9761.171] EconomicGeneralInfo: Total Units - 2
[9761.171] EconomicGeneralInfo: Maint Free Units - 0
[9761.171] EconomicGeneralInfo: Paid Units - 2
[9761.406] ChoosePantheonPopup: -149
[9761.406] ChoosePantheonPopup: 963
[9761.406] ChoosePantheonPopup: 814
[9761.468] ChooseIdeologyPopup: -149
@croxis
croxis / frag.glsl
Created July 31, 2013 23:22
Cubic spheres. Or: Rendering nice planets. Code is public domain.
uniform sampler2D p3d_Texture0;
varying vec2 texture_coordinate;
varying vec4 texCoords;
out varying vec4 FragColor;
void main(void)
{
FragColor = gl_Color;
}
uniform sampler2D p3d_Texture0;
varying vec2 texture_coordinate;
varying vec4 texCoords;
//
varying vec4 position;
// position of the vertex (and fragment) in view space
varying vec3 varyingNormalDirection;
// surface normal vector in view space
//
@croxis
croxis / orbit.py
Last active December 21, 2015 00:48
Compute the x,y,z position of a body relative to its parent, using precalculated orbital parameters, as a function of time
from math import sin, cos, radians, degrees, sqrt, atan2
#Imported from a json/yaml/whatever config file
#This is Earth's orbit. Time is number of Julian2000 days
planet_config = {
"a": 1.00000018,
"e": eval("lambda d: 0.01673163 - 3.661e-07 * d"),
"w": eval("lambda d: 108.04266274 + 0.0031795260 * d"),
"i": eval("lambda d: -0.00054346 + -0.0001337178 * d"),