• Like
Designing an Objective-C Framework about 3D
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Designing an Objective-C Framework about 3D

  • 4,165 views
Published

Blitz T

Blitz T

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,165
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
35
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Designing an Objective-C Framework about 3D (to Rule Them All) Raphael Sebbe Twitter: @rsebbe
  • 2. We all Enjoy Cocoa
  • 3. Because it’s Smart & Elegant
  • 4. Developers are UsersKeep that in mind when designing a framework
  • 5. The Wonderful World of 3D OpenGL Pixar’s PRMan Direct X POV Ogre 3Delight Quesa Pixie Aqsis OSG VL Lucille DotC OpenSG LuxRender Mental Ray 3DKit
  • 6. What• A framework for building 3D apps / games, for Mac & iOS• Common foundation for 3D• Specialized to talk to various libs / tools• Good Cocoa citizen
  • 7. Conceptualizing (a bit) App • Computer Graphics Math Ceed3DGL Ceed3DRenderMan ... • 3D Data Representation(s) Ceed3D • Object Graph(s) •GL CeedMath Foundation Rendering Interfaces
  • 8. Focus on FrameworksC3Node C3Scene C3Renderer C3Object C3RenderManRenderer C3ProceduralObject C3PixarRenderer C3Sphere C3AqsisRenderer ... C3GLRenderer C3GLView C3GeometricObject C3Mesh C3Geometry C3Buffer ... C3ParametricGeometry C3Light C3MeshGeometry C3Camera C3StreamGeometry C3Material C3SubdivisionGeometry
  • 9. Objects Talk TogetherValue Sphere A1.7 Radius Cube B Transform Parent Transform Cube C Transform Size
  • 10. Objects Talk TogetherValue Sphere A1.7 Radius Cube B Transform Parent Transform Cube C Transform Size Style Group 1 Style Group 2
  • 11. Coping with Diversity• Objective-C is high level• Sometimes, subclassing is your enemy• And then, categories are your friend• Renderer interface & file read/write’s as categories of existing classes
  • 12. Category UseCeed3D.framework C3Sphere C3MeshCeed3DGL.framework +GL +GLCeed3DRenderMan.framework +RenderMan +RenderMan +POV +Obj +3ds +Collada + ...
  • 13. Focus on OpenGL• Modern OpenGL only (no legacy calls)• Support for OpenGL ES• Sophisticated Shader Definition
  • 14. Focus on OpenGL• Modern OpenGL only (no legacy calls)• Support for OpenGL ES• Sophisticated Shader Definition Ceed3DGL • Thin Objective-C layer for OpenGLCeedGL Ceed3D • Encapsulates GL objects (texture, buffer, framebuffer, program, shader...)GL CeedMath • Defines Draw Commands
  • 15. Cocoa Interactions• KVO / KVC: easy access to object inputs/outputs• Core Image: CIImage used as textures, CIFilter as post process filters on rendered image• Quartz: NSBezierPath used as geometry source, incl. glyphs• Quartz Composer: Ceed3D should be able to render as a QCPlugin, QC outputs usable as Ceed3D textures• Grand Central Dispatch: Parallelism for computations• OpenCL: Geometry filters
  • 16. Examples! sphere = [C3Sphere sphere];! sphere.radius = 0.15;! sphere.translation.z = 0.3;!! C3GenericMaterial *material = [C3GenericMaterial genericMaterial];! material.diffuseColor = [C3Color redColor];! material.environmentImage = [C3Image imageWithContentsOfFile:! ! [[NSBundle mainBundle] pathForResource:@"skydome_1024" ofType:@"jpg"]];! sphere.defaultMaterial = material;!! [scene addNode:sphere];!! NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect! ! xRadius:0.1 yRadius:0.1];! [path appendBezierPath:[[NSBezierPath bezierPathWithOvalInRect:! ! NSInsetRect(rect, 0.15, 0.15)] bezierPathByReversingPath]];!! id options = [NSDictionary dictionaryWithObjectsAndKeys:C3DOUBLE(0.02),! ! kC3MeshOptionAdaptiveSubdivisionDistance, nil];!! C3MeshGeometry *geom = [C3MeshGeometry meshGeometryWithBezierPath:path! ! options:options];! C3Mesh *mesh = [C3Mesh mesh]; [mesh insertObject:geom inGeometriesAtIndex:0];! [scene addNode:mesh];
  • 17. Examples! glRenderer = [C3GLRenderer new];! glRenderer.scene = scene;!! glView.viewer.camera = camera;! glRenderer.viewers = [NSArray arrayWithObject:glView.viewer];! pixarRenderer = [C3PixarRenderer new];! pixarRenderer.outputDirectoryPath = @"~/Render/Ceed3D-pixar";! pixarRenderer.scene = scene;! aqsisRenderer = [C3AqsisRenderer new];! aqsisRenderer.outputDirectoryPath = @"~/Render/Ceed3D-aqsis";! aqsisRenderer.scene = scene; // .... [glRenderer render];
  • 18. Demo
  • 19. Demomesh = [C3Mesh meshWithAttributedString:@"" options:nil];
  • 20. Availability• Work in progress• Low-level, stable parts will be released as open source soon• We want to release more later...• Stay tuned!
  • 21. Thank you! Raphael SebbeTwitter: @rsebbe