Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Chameleon                             3D game engineTuesday, January 18, 2011
Overview    •OpenGL 2.0+ (desktop), ES 1.1, 2.0 (mobile)    •DirectX support (windows)    •C based    •Platform independen...
OpenGL ES    •OpenGL API subset    •Designed for embedded devices    •Perfect for 3D on the iPhone/iPod touch & iPad    •A...
Chameleon                              features    •Renderer abstraction    •Works on iOS, Android, Mac, Linux, Windows   ...
Features                            features (continued)    •3D model loading (geometry, textures)    •Skybox, sphere map ...
Architecture    •Window                 engine context setup         ‣Position on screen (or parent view) - x, y, width, h...
Architecture    •Canvas                 drawing layer         ‣Coordinate system functions (translate, rotate, scale, tran...
Snippets    •CImage *img = loadImage("test.jpg", kSmooth)    •image(img, 0, 0, img->width, img->height);    •CColor color;...
Example                                                             Lenna    float frameCount;                            ...
Example                                                             Lenna    float frameCount;                            ...
Live coding/deployment          ghter aircraft - model loading, environment, lighting, shadowsTuesday, January 18, 2011
?Tuesday, January 18, 2011
Upcoming SlideShare
Loading in …5
×

Chameleon game engine

5,001 views

Published on

Published in: Technology, Art & Photos
  • Be the first to comment

Chameleon game engine

  1. 1. Chameleon 3D game engineTuesday, January 18, 2011
  2. 2. Overview •OpenGL 2.0+ (desktop), ES 1.1, 2.0 (mobile) •DirectX support (windows) •C based •Platform independent •Lightweight, easy syntax •Complex API •Easily scalable •Tons of built-in featuresTuesday, January 18, 2011
  3. 3. OpenGL ES •OpenGL API subset •Designed for embedded devices •Perfect for 3D on the iPhone/iPod touch & iPad •Also perfect for Android •Hardware accelerated rendering on the GPU •CPU should do almost no work •...but it’s pretty complicated! •...quite hard to find the perfect optimizations •...inexperienced programmers will make games 50x slowerTuesday, January 18, 2011
  4. 4. Chameleon features •Renderer abstraction •Works on iOS, Android, Mac, Linux, Windows •Advanced 2D functions (arc, shape, bezier, catmull etc.) •Eye-candy effects (blend, glow, diffuse, tint etc.) •Fast image loading/compression (to 2 bits per pixel) •Lights (ambient, point, spot) and materials •Shadows, reflections •Shape primitives (cube, sphere, cylinder, torus etc.)Tuesday, January 18, 2011
  5. 5. Features features (continued) •3D model loading (geometry, textures) •Skybox, sphere map •Particle system emitters (fire, explosions etc.) •Imposters, billboard nodes (vegetation, trees etc.) •Camera (yaw, pitch, roll: position, rotation) •Camera controllers (arcball, fps, rpg, etc.) •Offscreen canvas •...plus, many others •...optimized for each platformTuesday, January 18, 2011
  6. 6. Architecture •Window engine context setup ‣Position on screen (or parent view) - x, y, width, height ‣Fullscreen (or not) ‣Display refresh rate, bits per pixel ‣Input and mouse (touch) position, state, gestures •Renderer hardware accelerated ‣Built-in capabilities abstraction layer ‣Around 20 extremely low level drawing functions ‣Entire engine relies only on them ‣Easily scalable on any hardwareTuesday, January 18, 2011
  7. 7. Architecture •Canvas drawing layer ‣Coordinate system functions (translate, rotate, scale, transform) ‣Styles (fill, stroke, tint, blend, alpha, add, mask etc.) ‣Pixels, points, lines, n-sided polygons (rectangle, ellipse etc.) ‣Convex/ concave shapes, bezier curves, cubic hermite splines ‣Images, sprites, animations ‣3D primitives (cube, sphere, cylinder, capsule, torus etc.) ‣Lights, shadows, materials, reflections setup + Core extensions the user friendly high-level interface + Utilities the must-have game API (resource locator, image loader, files, sound, xml etc.)Tuesday, January 18, 2011
  8. 8. Snippets •CImage *img = loadImage("test.jpg", kSmooth) •image(img, 0, 0, img->width, img->height); •CColor color; •getImagePixel(img, &color, 100, 100); •setImagePixel(img, initColor(255, 0, 0, 128), 100, 100); •CModel *model = loadModel("fighter.3ds"); •geometryRotation(model->geometry, PI, -HALF_PI, 0); •drawModel(model); •pointLight(0, initVector3(5, -2, 0), initAmbient(192, 192, 128), ! ! ! initDiffuse(192, 192, 192), ! ! ! initSpecular(255, 128, 64)); •materialSpecular(255, 255, 255); •materialShininess(128); •translate(5, 2, -6); •rotate(radians(60), 1, 1, 0); •scale(2, 3, 1);Tuesday, January 18, 2011
  9. 9. Example Lenna float frameCount; - (void)draw { ! clear(); CArcball *arcb; ! origin(); CColor *col; ! CImage *img; ! translateZ(-4);! ! rotateScene(arcb); #define step 2 ! ! noFill(); - (void)setup { ! whiteStroke(); ! defaults(); ! cube(0, 0, 0, img->width, img->height, img->width); ! optimize3D(); ! ellipse(0, 0, e.width, e.width); ! noPointSmooth(); ! ! createPrimitives(); ! beginPixels(); ! ! for (float i = 0; i < img->width; i += step) { ! perspective(45, (float)e.width / e.height, 1, 100); ! ! for (float j = 0; j < img->height; j += step) { ! ! ! ! getImagePixel(img, col, i, j); ! arcb = initArcball(e.width / 2, e.height / 2, e.height); ! ! ! float br = brightness(col->r, col->g, col->b); ! col = initColor(0, 0, 0, 0); ! ! ! pixelColor(i - img->width / 2, ! img = loadImage("lenna320.jpg", kSmooth); ! ! ! ! ! j - img->height / 2, } ! ! ! ! ! br * fastsin(frameCount) / 2, ! ! ! ! ! col->r, col->g, col->b, 255); ! ! } ! } ! endPixels(); ! frameCount += .1; ! ! gl.present(self.view); }Tuesday, January 18, 2011
  10. 10. Example Lenna float frameCount; - (void)draw { ! clear(); CArcball *arcb; ! origin(); CColor *col; ! CImage *img; ! translateZ(-4);! ! rotateScene(arcb); #define step 2 ! ! noFill(); - (void)setup { ! whiteStroke(); ! defaults(); ! cube(0, 0, 0, img->width, img->height, img->width); ! optimize3D(); ! ellipse(0, 0, e.width, e.width); ! noPointSmooth(); ! ! createPrimitives(); ! beginPixels(); ! ! for (float i = 0; i < img->width; i += step) { ! perspective(45, (float)e.width / e.height, 1, 100); ! ! for (float j = 0; j < img->height; j += step) { ! ! ! ! getImagePixel(img, col, i, j); ! arcb = initArcball(e.width / 2, e.height / 2, e.height); ! ! ! float br = brightness(col->r, col->g, col->b); ! col = initColor(0, 0, 0, 0); ! ! ! pixelColor(i - img->width / 2, ! img = loadImage("lenna320.jpg", kSmooth); ! ! ! ! ! j - img->height / 2, } ! ! ! ! ! br * fastsin(frameCount) / 2, ! ! ! ! ! col->r, col->g, col->b, 255); ! ! } ! } ! endPixels(); ! frameCount += .1; ! ! gl.present(self.view); }Tuesday, January 18, 2011
  11. 11. Live coding/deployment ghter aircraft - model loading, environment, lighting, shadowsTuesday, January 18, 2011
  12. 12. ?Tuesday, January 18, 2011

×