Permalink
Browse files

- initial commit to Repository

  • Loading branch information...
0 parents commit 50364fb87645d615c8522ac05d96d46eb130372a jlamarche committed Oct 19, 2010
Showing with 42,475 additions and 0 deletions.
  1. +12 −0 .gitignore
  2. +120 −0 Blender Export/objc-export-2.4.9/objc.py
  3. +50 −0 Blender Export/objc-export-2.5/objc.py
  4. +18 −0 Categories/UIColor-OpenGL.h
  5. +79 −0 Categories/UIColor-OpenGL.m
  6. +18 −0 Classes/JDLGLUtils.h
  7. +58 −0 Classes/JDLGLUtils.m
  8. +33 −0 OpenGL ES 1.1 Project Template/Classes/ConstantsAndMacros.h
  9. +41 −0 OpenGL ES 1.1 Project Template/Classes/GLView.h
  10. +15 −0 OpenGL ES 1.1 Project Template/Classes/GLViewController.h
  11. +40 −0 OpenGL ES 1.1 Project Template/Classes/GLViewController.m
  12. +1,040 −0 OpenGL ES 1.1 Project Template/Classes/OpenGLCommon.h
  13. +22 −0 OpenGL ES 1.1 Project Template/Classes/OpenGLTexture3D.h
  14. +88 −0 OpenGL ES 1.1 Project Template/Classes/OpenGLTexture3D.m
  15. +22 −0 OpenGL ES 1.1 Project Template/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.h
  16. +40 −0 OpenGL ES 1.1 Project Template/Classes/___PROJECTNAMEASIDENTIFIER___AppDelegate.m
  17. +156 −0 OpenGL ES 1.1 Project Template/GLView.m
  18. +500 −0 OpenGL ES 1.1 Project Template/MainWindow.xib
  19. +516 −0 OpenGL ES 1.1 Project Template/Resources-iPad/MainWindow-iPad.xib
  20. +32 −0 OpenGL ES 1.1 Project Template/___PROJECTNAMEASIDENTIFIER___-Info.plist
  21. +9 −0 OpenGL ES 1.1 Project Template/___PROJECTNAMEASIDENTIFIER____Prefix.pch
  22. BIN OpenGL ES 1.1 Project Template/___PROJECTNAME___.xcodeproj/TemplateIcon.icns
  23. +8 −0 OpenGL ES 1.1 Project Template/___PROJECTNAME___.xcodeproj/TemplateInfo.plist
  24. +289 −0 OpenGL ES 1.1 Project Template/___PROJECTNAME___.xcodeproj/project.pbxproj
  25. +17 −0 OpenGL ES 1.1 Project Template/main.m
  26. +23 −0 README
  27. BIN Simple OpenGL ES 1.1 example/.zip
  28. +18 −0 Simple OpenGL ES 1.1 example/Classes/ConstantsAndMacros.h
  29. +40 −0 Simple OpenGL ES 1.1 example/Classes/GLView.h
  30. +203 −0 Simple OpenGL ES 1.1 example/Classes/GLView.m
  31. +21 −0 Simple OpenGL ES 1.1 example/Classes/GLViewController.h
  32. +189 −0 Simple OpenGL ES 1.1 example/Classes/GLViewController.m
  33. +669 −0 Simple OpenGL ES 1.1 example/Classes/OpenGLCommon.h
  34. +18 −0 Simple OpenGL ES 1.1 example/Classes/Part6ProjectAppDelegate.h
  35. +45 −0 Simple OpenGL ES 1.1 example/Classes/Part6ProjectAppDelegate.m
  36. +28 −0 Simple OpenGL ES 1.1 example/Info.plist
  37. +189 −0 Simple OpenGL ES 1.1 example/MainWindow.xib
  38. +3 −0 Simple OpenGL ES 1.1 example/Part6Project_Prefix.pch
  39. +1,417 −0 Simple OpenGL ES 1.1 example/Part8Project.xcodeproj/jeff.mode1v3
  40. +320 −0 Simple OpenGL ES 1.1 example/Part8Project.xcodeproj/jeff.pbxuser
  41. +1,524 −0 Simple OpenGL ES 1.1 example/Part8Project.xcodeproj/jeff.perspectivev3
  42. +291 −0 Simple OpenGL ES 1.1 example/Part8Project.xcodeproj/project.pbxproj
  43. +18 −0 Simple OpenGL ES 1.1 example/main.m
  44. +302 −0 Simple OpenGL ES 2.0 Example/Classes/GLCommon.h
  45. +18 −0 Simple OpenGL ES 2.0 Example/Classes/GLProgram.h
  46. +182 −0 Simple OpenGL ES 2.0 Example/Classes/GLProgram.m
  47. +22 −0 Simple OpenGL ES 2.0 Example/Classes/GLTexture.h
  48. +80 −0 Simple OpenGL ES 2.0 Example/Classes/GLTexture.m
  49. +17 −0 Simple OpenGL ES 2.0 Example/Classes/GLView.h
  50. +189 −0 Simple OpenGL ES 2.0 Example/Classes/GLView.m
  51. +14 −0 Simple OpenGL ES 2.0 Example/Classes/GLViewController.h
  52. +252 −0 Simple OpenGL ES 2.0 Example/Classes/GLViewController.m
  53. +20 −0 Simple OpenGL ES 2.0 Example/Classes/Hello_GLAppDelegate.h
  54. +27 −0 Simple OpenGL ES 2.0 Example/Classes/Hello_GLAppDelegate.m
  55. BIN Simple OpenGL ES 2.0 Example/DieTexture.png
  56. +30 −0 Simple OpenGL ES 2.0 Example/Hello_GL-Info.plist
  57. +8 −0 Simple OpenGL ES 2.0 Example/Hello_GL_Prefix.pch
  58. BIN Simple OpenGL ES 2.0 Example/IcoTexture.jpg
  59. +372 −0 Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/jeff.pbxuser
  60. +1,530 −0 Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/jeff.perspectivev3
  61. +304 −0 Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/project.pbxproj
  62. +6 −0 Simple OpenGL ES 2.0 Example/Icosahedron.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  63. +6,899 −0 .../Icosahedron.xcodeproj/project.xcworkspace/xcuserdata/jeff.xcuserdatad/WorkspaceState.xcuserstate
  64. +4 −0 ....0 Example/Icosahedron.xcodeproj/xcuserdata/jeff.xcuserdatad/xcbreakpoints/Breakpoints.xcbkptlist
  65. +20 −0 ...enGL ES 2.0 Example/Icosahedron.xcodeproj/xcuserdata/jeff.xcuserdatad/xcschemes/Hello GL.xcscheme
  66. +19 −0 ... 2.0 Example/Icosahedron.xcodeproj/xcuserdata/jeff.xcuserdatad/xcschemes/xcschememanagement.plist
  67. +270 −0 Simple OpenGL ES 2.0 Example/MainWindow.xib
  68. +6 −0 Simple OpenGL ES 2.0 Example/Shader.fsh
  69. +9 −0 Simple OpenGL ES 2.0 Example/Shader.vsh
  70. +17 −0 Simple OpenGL ES 2.0 Example/main.m
  71. +23 −0 Wavefront OBJ Loader/Classes/ConstantsAndMacros.h
  72. +40 −0 Wavefront OBJ Loader/Classes/GLView.h
  73. +204 −0 Wavefront OBJ Loader/Classes/GLView.m
  74. +31 −0 Wavefront OBJ Loader/Classes/GLViewController.h
  75. +146 −0 Wavefront OBJ Loader/Classes/GLViewController.m
  76. +21 −0 Wavefront OBJ Loader/Classes/OpenGLTexture3D.h
  77. +80 −0 Wavefront OBJ Loader/Classes/OpenGLTexture3D.m
  78. +308 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontCommon.h
  79. +35 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontGroup.h
  80. +44 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontGroup.m
  81. +35 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontMaterial.h
  82. +169 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontMaterial.m
  83. +49 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontObject.h
  84. +387 −0 Wavefront OBJ Loader/Classes/OpenGLWaveFrontObject.m
  85. +18 −0 Wavefront OBJ Loader/Classes/Wavefront_OBJ_LoaderAppDelegate.h
  86. +50 −0 Wavefront OBJ Loader/Classes/Wavefront_OBJ_LoaderAppDelegate.m
  87. +47 −0 Wavefront OBJ Loader/Classes/gluLookAt.h
  88. +85 −0 Wavefront OBJ Loader/Classes/gluLookAt.m
  89. +28 −0 Wavefront OBJ Loader/Info.plist
  90. +189 −0 Wavefront OBJ Loader/MainWindow.xib
  91. BIN Wavefront OBJ Loader/Models/cube_template_Cube-256.pvr4
  92. BIN Wavefront OBJ Loader/Models/cube_template_Cube.tga
  93. +72 −0 Wavefront OBJ Loader/Models/cylinder2.mtl
  94. +342 −0 Wavefront OBJ Loader/Models/cylinder2.obj
  95. +12 −0 Wavefront OBJ Loader/Models/earth.mtl
  96. +180 −0 Wavefront OBJ Loader/Models/earth.obj
  97. +52 −0 Wavefront OBJ Loader/Models/plane3.mtl
  98. +17,207 −0 Wavefront OBJ Loader/Models/plane3.obj
  99. BIN Wavefront OBJ Loader/Models/sphere-256.pvr4
  100. BIN Wavefront OBJ Loader/Models/texture1-128.pvr4
  101. +13 −0 Wavefront OBJ Loader/Models/uvcube2.mtl
  102. +47 −0 Wavefront OBJ Loader/Models/uvcube2.obj
  103. +1,457 −0 Wavefront OBJ Loader/Wavefront OBJ Loader.xcodeproj/jeff.mode1v3
  104. +338 −0 Wavefront OBJ Loader/Wavefront OBJ Loader.xcodeproj/jeff.pbxuser
  105. +1,538 −0 Wavefront OBJ Loader/Wavefront OBJ Loader.xcodeproj/jeff.perspectivev3
  106. +351 −0 Wavefront OBJ Loader/Wavefront OBJ Loader.xcodeproj/project.pbxproj
  107. +3 −0 Wavefront OBJ Loader/Wavefront_OBJ_Loader_Prefix.pch
  108. +18 −0 Wavefront OBJ Loader/main.m
@@ -0,0 +1,12 @@
+build
+*.xcodeproj/*.pbxuser
+*.xcodeproj/*.perspectivev3
+.DS_Store
+.Spotlight-V100
+*.hidden
+*.Trash
+/tmp/**
+*.hotfiles.btree
+/.vol
+.svn
+.svn/*
@@ -0,0 +1,120 @@
+#!BPY
+
+"""
+Name: 'Objective-C Header (.h)'
+Blender: 244
+Group: 'Export'
+Tooltip: 'Exports header file for use with the OpenGL ES template for iPhone available from http://iphonedevelopment.blogspot.com/'
+"""
+import Blender
+from Blender import *
+import bpy
+import bpy
+import os
+
+
+def write_obj(filepath):
+ out = file(filepath, 'w')
+ sce = bpy.data.scenes.active
+ ob = sce.objects.active
+ mesh = Mesh.New()
+ mesh.getFromObject(ob.name)
+
+ editmode = Window.EditMode()
+ if editmode: Window.EditMode(0)
+ has_quads = False
+ for f in mesh.faces:
+ if len(f) == 4:
+ has_quads = True
+ break
+
+ if has_quads:
+ oldmode = Mesh.Mode()
+ Mesh.Mode(Mesh.SelectModes['FACE'])
+
+ mesh.sel = True
+ tempob = sce.objects.new(mesh)
+ mesh.quadToTriangle(0) # more=0 shortest length
+ oldmode = Mesh.Mode(oldmode)
+ sce.objects.unlink(tempob)
+
+ Mesh.Mode(oldmode)
+
+ objectname = ob.getData(True)
+ basename = objectname.capitalize()
+
+ out.write('#import "OpenGLCommon.h"\n\n\n')
+
+ if (mesh.faceUV):
+ out.write('static const TexturedVertexData3D %sVertexData[] = {\n' % basename)
+ for face in mesh.faces:
+ for (vert, uvert) in zip(face.verts, face.uv):
+ out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
+ out.write('/*n:*/{%f, %f, %f}, ' % (vert.no.x, vert.no.y, vert.no.z))
+ out.write('/*t:*/{%f, %f}' % ( uvert.x, uvert.y ) )
+ out.write('},\n')
+ out.write('};\n\n')
+ elif (mesh.vertexColors):
+ out.write('static const ColoredVertexData3D %sVertexData[] = {\n' % basename)
+ for face in mesh.faces:
+ for (vert, color) in zip(face.verts, face.col):
+ out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
+ out.write('/*n:*/{%f, %f, %f}, ' % (vert.no.x, vert.no.y, vert.no.z))
+ out.write('/*c:*/{%f, %f, %f, %f}' % ( color.r / 255.0, color.g / 255.0, color.b / 255.0, color.a / 255.0) )
+ out.write('},\n')
+ out.write('};\n\n')
+ else:
+ out.write
+ out.write('static const VertexData3D %sVertexData[] = {\n' % basename)
+ for face in mesh.faces:
+ for vert in face.verts:
+ out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
+ out.write('/*n:*/{%f, %f, %f} ' % (vert.no.x, vert.no.y, vert.no.z))
+ out.write('},\n')
+ out.write('};\n\n')
+
+ if editmode: Window.EditMode(1)
+ out.write('#define k%sNumberOfVertices\t%i\n' % (basename, len(mesh.faces) * 3) )
+
+ out.write('// Drawing Code:\n')
+ out.write('// glEnableClientState(GL_VERTEX_ARRAY);\n')
+ if (mesh.faceUV):
+ out.write('// glEnableClientState(GL_TEXTURE_COORD_ARRAY);\n')
+ elif (mesh.vertexColors):
+ out.write('// glEnableClientState(GL_COLOR_ARRAY);\n')
+ out.write('// glEnable(GL_COLOR_MATERIAL)\n')
+ out.write('// glEnableClientState(GL_NORMAL_ARRAY);\n')
+ out.write('// glVertexPointer(3, GL_FLOAT, sizeof(')
+ if (mesh.faceUV):
+ out.write('TexturedVertexData3D')
+ elif (mesh.vertexColors):
+ out.write('ColoredVertexData3D')
+ else:
+ out.write('VertexData3D')
+ out.write('), &%sVertexData[0].vertex);\n' % basename)
+ out.write('// glNormalPointer(GL_FLOAT, sizeof(')
+ if (mesh.faceUV):
+ out.write('TexturedVertexData3D')
+ elif (mesh.vertexColors):
+ out.write('ColoredVertexData3D')
+ else:
+ out.write('VertexData3D')
+ out.write('), &%sVertexData[0].normal);\n' % basename)
+ if (mesh.faceUV):
+ out.write('// glTexCoordPointer(2, GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].texCoord);\n' % basename)
+ elif (mesh.vertexColors):
+ out.write('// glColorPointer(4, GL_FLOAT, sizeof(ColoredVertexData3D), &%sVertexData[0].color);\n' % basename)
+ out.write('// glDrawArrays(GL_TRIANGLES, 0, k%sNumberOfVertices);\n' % basename)
+ out.write('// glDisableClientState(GL_VERTEX_ARRAY);\n')
+ if (mesh.faceUV):
+ out.write('// glDisableClientState(GL_TEXTURE_COORD_ARRAY);\n')
+ elif (mesh.vertexColors):
+ out.write('// glDisableClientState(GL_NORMAL_ARRAY);\n')
+ out.write('// glDisable(GL_COLOR_MATERIAL);\n')
+ out.write('// glDisableClientState(GL_NORMAL_ARRAY);\n\n\n')
+
+ out.close()
+
+
+filename = os.path.splitext(Blender.Get('filename'))[0]
+Blender.Window.FileSelector(write_obj, "Export", '%s.h' % filename)
@@ -0,0 +1,50 @@
+#!BPY
+
+"""
+Name: 'Objective-C Header (.h)'
+Blender: 244
+Group: 'Export'
+Tooltip: 'Exports header file for use with the OpenGL ES template for iPhone available from http://iphonedevelopment.blogspot.com/'
+"""
+import Blender
+from Blender import Mathutils
+from Blender.Mathutils import *
+import bpy
+import os
+
+def write_obj(filepath):
+ out = file(filepath, 'w')
+ sce = bpy.data.scenes.active
+ ob = sce.objects.active
+ mesh = ob.getData(mesh=1)
+ objectname = ob.getData(True)
+ basename = objectname.capitalize()
+
+ out.write('#import "OpenGLCommon.h"\n\n\n')
+ out.write('static const TexturedVertexData3D %sVertexData[] = {\n' % basename)
+ for face in mesh.faces:
+ for (vert, uvert) in zip(face.v, face.uv):
+ out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
+ out.write('/*n:*/{%f, %f, %f}, ' % (vert.no.x, vert.no.y, vert.no.z))
+ out.write('/*t:*/{%f, %f}' % ( uvert.x, uvert.y ) )
+ out.write('},\n')
+ out.write('};\n\n')
+
+ out.write('#define k%sNumberOfVertices\t%i\n' % (basename, len(mesh.faces) * 3) )
+
+ out.write('// Drawing Code:')
+ out.write('// glEnableClientState(GL_VERTEX_ARRAY);\n')
+ out.write('// glEnableClientState(GL_TEXTURE_COORD_ARRAY);\n')
+ out.write('// glEnableClientState(GL_NORMAL_ARRAY);\n')
+ out.write('// glVertexPointer(3, GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].vertex);\n' % basename)
+ out.write('// glNormalPointer(GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].normal);\n' % basename)
+ out.write('// glTexCoordPointer(2, GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].texCoord);\n' % basename)
+ out.write('// glDrawArrays(GL_TRIANGLES, 0, k%sNumberOfVertices);\n' % basename)
+ out.write('// glDisableClientState(GL_VERTEX_ARRAY);\n')
+ out.write('// glDisableClientState(GL_TEXTURE_COORD_ARRAY);\n')
+ out.write('// glDisableClientState(GL_NORMAL_ARRAY);\n\n\n')
+
+ out.close()
+
+filename = os.path.splitext(Blender.Get('filename'))[0]
+Blender.Window.FileSelector(write_obj, "Export", '%s.h' % filename
@@ -0,0 +1,18 @@
+//
+// UIColor-OpenGL.h
+// GLTest
+//
+// Created by Jeff LaMarche on 8/21/08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <OpenGLES/EAGL.h>
+#import <OpenGLES/ES1/gl.h>
+#import <OpenGLES/ES1/glext.h>
+#import <OpenGLES/EAGLDrawable.h>
+
+@interface UIColor(OpenGL)
+- (void)setOpenGLColor;
+- (void)setColorArrayToColor:(UIColor *)toColor;
+@end
@@ -0,0 +1,79 @@
+//
+// UIColor-OpenGL.m
+// GLTest
+//
+// Created by Jeff LaMarche on 8/21/08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "UIColor-OpenGL.h"
+
+@implementation UIColor(OpenGL)
+- (void)setOpenGLColor
+{
+ int numComponents = CGColorGetNumberOfComponents(self.CGColor);
+ const CGFloat *components = CGColorGetComponents(self.CGColor);
+ if (numComponents == 2)
+ {
+ CGFloat all = components[0];
+ CGFloat alpha = components[1];
+ glColor4f(all,all, all, alpha);
+ }
+ else
+ {
+
+ CGFloat red = components[0];
+ CGFloat green = components[1];
+ CGFloat blue = components[2];
+ CGFloat alpha = components[3];
+ glColor4f(red,green, blue, alpha);
+ }
+
+}
+- (void)setColorArrayToColor:(UIColor *)toColor
+{
+ GLfloat *colorArray = malloc(sizeof(GLfloat) * 8);
+
+ int numComponents = CGColorGetNumberOfComponents(self.CGColor);
+ const CGFloat *components = CGColorGetComponents(self.CGColor);
+
+
+ if (numComponents == 2)
+ {
+ colorArray[0] = components[0];
+ colorArray[1] = components[0];
+ colorArray[2] = components[0];
+ colorArray[3] = components[1];
+ }
+ else
+ {
+ // Assuming RGBA if not grayscale
+ colorArray[0] = components[0];
+ colorArray[1] = components[1];
+ colorArray[2] = components[2];
+ colorArray[3] = components[3];
+ }
+
+ int otherColorNumComponents = CGColorGetNumberOfComponents(toColor.CGColor);
+ const CGFloat *otherComponents = CGColorGetComponents(toColor.CGColor);
+ if (otherColorNumComponents == 2)
+ {
+ colorArray[4] = otherComponents[0];
+ colorArray[5] = otherComponents[0];
+ colorArray[6] = otherComponents[0];
+ colorArray[7] = otherComponents[1];
+ }
+ else
+ {
+ // Assuming RGBA if not grayscale
+ colorArray[4] = otherComponents[0];
+ colorArray[5] = otherComponents[1];
+ colorArray[6] = otherComponents[2];
+ colorArray[7] = otherComponents[3];
+ }
+
+ glColorPointer (4, GL_FLOAT, 4*sizeof(GLfloat), colorArray);
+ free(colorArray);
+
+}
+@end
@@ -0,0 +1,18 @@
+/*
+ * JDLGLUtils.h
+ * Space Castle
+ *
+ * Created by Jeff LaMarche on 9/27/08.
+ * Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+#import <Foundation/Foundation.h>
+#import <OpenGLES/ES1/gl.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+
+void GLDrawCircle (int circleSegments, CGFloat circleSize, CGPoint center, bool filled);
+void GLDrawEllipse (int segments, CGFloat width, CGFloat height, CGPoint center, bool filled);
+void GLDrawSpokes (int spokeCount, CGFloat radius, CGPoint center);
+void GLDrawEllipticalSpokes(int spokeCount, CGFloat width, CGFloat height, CGPoint center);
+void GLDrawEllipticalSpokesWithGradient(int spokeCount, CGFloat width, CGFloat height, CGPoint center, UIColor *innerColor, UIColor *outerColor);
@@ -0,0 +1,58 @@
+/*
+ * JDLGLUtils.c
+ * Space Castle
+ *
+ * Created by Jeff LaMarche on 9/27/08.
+ * Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "JDLGLUtils.h"
+#include <math.h>
+#include "Constants.h"
+#include "UIColor-OpenGL.h"
+
+void GLDrawCircle (int circleSegments, CGFloat circleSize, CGPoint center, bool filled)
+{
+ GLDrawEllipse(circleSegments, circleSize, circleSize, center, filled);
+}
+void GLDrawEllipse (int segments, CGFloat width, CGFloat height, CGPoint center, bool filled)
+{
+ glTranslatef(center.x, center.y, 0.0);
+ GLfloat vertices[segments*2];
+ int count=0;
+ for (GLfloat i = 0; i < 360.0f; i+=(360.0f/segments))
+ {
+ vertices[count++] = (cos(degreesToRadian(i))*width);
+ vertices[count++] = (sin(degreesToRadian(i))*height);
+ }
+ glVertexPointer (2, GL_FLOAT , 0, vertices);
+ glDrawArrays ((filled) ? GL_TRIANGLE_FAN : GL_LINE_LOOP, 0, segments);
+}
+void GLDrawSpokes (int spokeCount, CGFloat radius, CGPoint center)
+{
+ GLDrawEllipticalSpokes(spokeCount, radius, radius, center);
+}
+void GLDrawEllipticalSpokes(int spokeCount, CGFloat width, CGFloat height, CGPoint center)
+{
+ glTranslatef(center.x, center.y, 0.0);
+ for (GLfloat i = 0; i < 360.0f; i+=(360.0f/spokeCount))
+ {
+ GLfloat vertices[4] = {0.0, 0.0, cos(degreesToRadian(i))*width, sin(degreesToRadian(i))*height};
+ glVertexPointer(2, GL_FLOAT, 0, vertices);
+ glDrawArrays (GL_LINES, 0, 2);
+ }
+}
+void GLDrawEllipticalSpokesWithGradient(int spokeCount, CGFloat width, CGFloat height, CGPoint center, UIColor *innerColor, UIColor *outerColor)
+{
+ glTranslatef(center.x, center.y, 0.0);
+ for (GLfloat i = 0; i < 360.0f; i+=(360.0f/spokeCount))
+ {
+ glEnableClientState (GL_COLOR_ARRAY);
+ [innerColor setColorArrayToColor:outerColor];
+ GLfloat vertices[4] = {0.0, 0.0, cos(degreesToRadian(i))*width, sin(degreesToRadian(i))*height};
+ glVertexPointer(2, GL_FLOAT, 0, vertices);
+ glDrawArrays (GL_LINES, 0, 2);
+ glDisableClientState(GL_COLOR_ARRAY);
+ }
+}
@@ -0,0 +1,33 @@
+//
+// ConstantsAndMacros.h
+// Particles
+//
+
+// How many times a second to refresh the screen
+#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+#define kRenderingFrequency 15.0
+#define kInactiveRenderingFrequency 5.0
+#else
+#define kRenderingFrequency 30.0
+#define kInactiveRenderingFrequency 3.0
+#endif
+// For setting up perspective, define near, far, and angle of view
+#define kZNear 0.01
+#define kZFar 1000.0
+#define kFieldOfView 45.0
+// Defines whether to setup and use a depth buffer
+#define USE_DEPTH_BUFFER 1
+// Set to 1 if you want it to attempt to create a 2.0 context
+#define kAttemptToUseOpenGLES2 0
+
+#define QUATERNION_TRACE_ZERO_TOLERANCE 0.1
+
+// Macros
+#define DEGREES_TO_RADIANS(__ANGLE__) ((__ANGLE__) / 180.0 * M_PI)
+
+// Debug Loggers
+#define NSStubLog() NSLog(@"%s", __PRETTY_FUNCTION__)
+#define NSDebugPrintMatrix(matrix) for (int i = 0; i < 4; i ++) \
+ NSLog(@"[%f] [%f] [%f] [%f]", matrix[i], matrix[i+4], matrix[i+8], matrix[i+12])
+
+#define NSDebugPrintQuaternion(quat) NSLog(@"Quaternion: [%f] [%f] [%f] [%f]", quat.x, quat.y, quat.z, quat.w)
Oops, something went wrong. Retry.

0 comments on commit 50364fb

Please sign in to comment.