Skip to content

Instantly share code, notes, and snippets.

View hdon's full-sized avatar

Donny Viszneki hdon

View GitHub Profile
#!/usr/bin/env python
import gtk, gtk.glade as glade
class Application(object):
def __init__(self):
self.glade = glade.XML('spritecaster.glade')
self.glade.signal_autoconnect({
'on_window1_delete_event': self.delete_event,
'on_window1_destroy_event': self.destroy,
'on_auto_button_toggled': self.auto_tool_button,
'on_div_tool_button_toggled': self.div_tool_button,
# config.mak
CFLAGS:=-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DSHAREPATH=\"/usr/local/share\" -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEVAL -DNETWORK -DOGL -DNO_ASM -I/usr/include/asm-i486 -Iarch/linux/include
LDFLAGS:=-L/usr/lib -lSDL -lphysfs -lGL -lGLU
# Makefile
include config.mak
CFLAGS:=$(CFLAGS) -Iinclude -Imain -Iarch/include
Index: include/physfsrwops.h
===================================================================
--- include/physfsrwops.h (revision 889)
+++ include/physfsrwops.h (working copy)
@@ -28,7 +28,7 @@
#else
#include <physfs/physfs.h>
#endif
-#include <SDL/SDL.h>
+#include <SDL.h>
#include <sstream>
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
stringstream ss;
ss << "my favorite number follows: " << 12345;
cout << ss.str() << endl;
return 0;
}
#include <SDL.h>
#include <SDL_image.h>
#ifdef __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
#include <SDL.h>
#include <SDL_image.h>
#ifdef __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
myMesh = Mesh.Primitives.Cube(2.0)
myMesh.faces[0].v
([MVert (1.000000 1.000000 1.414214) (0.577349 0.577349 0.577349) 0], [MVert (-1.000000 1.000000 1.414214) (-0.577349 0.577349 0.577349) 3], [MVert (-1.000000 -1.000000 1.414214) (-0.577349 -0.577349 0.577349) 2], [MVert (1.000000 -1.000000 1.414214) (0.577349 -0.577349 0.577349) 1])
myMesh = Mesh.Primitives.Cube(1.0)
myMesh.faces[0].v
([MVert (0.500000 0.500000 0.707107) (0.577349 0.577349 0.577349) 0], [MVert (-0.500000 0.500000 0.707107) (-0.577349 0.577349 0.577349) 3], [MVert (-0.500000 -0.500000 0.707107) (-0.577349 -0.577349 0.577349) 2], [MVert (0.500000 -0.500000 0.707107) (0.577349 -0.577349 0.577349) 1])
file.write('f')
if faceuv:
if EXPORT_NORMALS:
if f_smooth: # Smoothed, use vertex normals
for vi, v in enumerate(f_v):
file.write( ' %d/%d/%d' % (\
v.index+totverts,\
totuvco + uv_face_mapping[f_index][vi],\
globalNormals[ veckey3d(v.no) ])) # vert, uv, normal
donny@teamspace:~/.blender/scripts$ diff obj_export.py obj_export2.py
4c4
< Name: 'Wavefront (.obj)...'
---
> Name: 'Wavefront (w/color) (.obj)...'
10c10
< __author__ = "Campbell Barton, Jiri Hnidek"
---
> __author__ = "Campbell Barton, Jiri Hnidek, Donny Viszneki"
12c12
# code borrowed from here:
# http://www.pygame.org/wiki/OBJFileLoader
import pygame, re
from OpenGL.GL import *
def MTL(filename):
contents = {}
mtl = None
for line in open(filename, "r"):
if line.startswith('#'): continue