SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
Chameleon
                             3D game engine



Tuesday, January 18, 2011
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 features
Tuesday, January 18, 2011
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 slower
Tuesday, January 18, 2011
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
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 platform
Tuesday, January 18, 2011
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 hardware

Tuesday, January 18, 2011
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
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
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
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
Live coding/deployment
          ghter aircraft - model loading, environment, lighting, shadows




Tuesday, January 18, 2011
?


Tuesday, January 18, 2011

Weitere ähnliche Inhalte

Was ist angesagt?

openFrameworks 007 - graphics
openFrameworks 007 - graphicsopenFrameworks 007 - graphics
openFrameworks 007 - graphics
roxlu
 
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficientTh 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Bin Shao
 

Was ist angesagt? (17)

Quartz 2D with Swift 3
Quartz 2D with Swift 3Quartz 2D with Swift 3
Quartz 2D with Swift 3
 
Introduction to Game Programming Tutorial
Introduction to Game Programming TutorialIntroduction to Game Programming Tutorial
Introduction to Game Programming Tutorial
 
openFrameworks 007 - 3D
openFrameworks 007 - 3DopenFrameworks 007 - 3D
openFrameworks 007 - 3D
 
openFrameworks 007 - utils
openFrameworks 007 - utilsopenFrameworks 007 - utils
openFrameworks 007 - utils
 
Android UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesAndroid UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and Techniques
 
Proga 090525
Proga 090525Proga 090525
Proga 090525
 
미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정미려한 UI/UX를 위한 여정
미려한 UI/UX를 위한 여정
 
Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019
 
ECMA5 and ES6 Promises
ECMA5 and ES6 PromisesECMA5 and ES6 Promises
ECMA5 and ES6 Promises
 
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
 
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
 
My favorite slides
My favorite slidesMy favorite slides
My favorite slides
 
openFrameworks 007 - graphics
openFrameworks 007 - graphicsopenFrameworks 007 - graphics
openFrameworks 007 - graphics
 
How to make a video game
How to make a video gameHow to make a video game
How to make a video game
 
Lecture9
Lecture9Lecture9
Lecture9
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficientTh 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
 

Ähnlich wie Chameleon game engine

MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome Bits
Spiffy
 
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
alokopticalswatchco0
 
Денис Лебедев, Swift
Денис Лебедев, SwiftДенис Лебедев, Swift
Денис Лебедев, Swift
Yandex
 
Displaying information within a window.68
Displaying information within a window.68Displaying information within a window.68
Displaying information within a window.68
myrajendra
 

Ähnlich wie Chameleon game engine (20)

MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome Bits
 
Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
 
Building Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
Building Native Apps- A Digital Canvas for Coders and Designers with Walter LuhBuilding Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
Building Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
 
Real life XNA
Real life XNAReal life XNA
Real life XNA
 
september11.ppt
september11.pptseptember11.ppt
september11.ppt
 
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
 
Histogram dan Segmentasi
Histogram dan SegmentasiHistogram dan Segmentasi
Histogram dan Segmentasi
 
Histogram dan Segmentasi 2
Histogram dan Segmentasi 2Histogram dan Segmentasi 2
Histogram dan Segmentasi 2
 
Building a Visualization Language
Building a Visualization LanguageBuilding a Visualization Language
Building a Visualization Language
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 Canvas
 
Open cv tutorial
Open cv tutorialOpen cv tutorial
Open cv tutorial
 
Денис Лебедев, Swift
Денис Лебедев, SwiftДенис Лебедев, Swift
Денис Лебедев, Swift
 
Displaying information within a window.68
Displaying information within a window.68Displaying information within a window.68
Displaying information within a window.68
 
Google tools for webmasters
Google tools for webmastersGoogle tools for webmasters
Google tools for webmasters
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
 
Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例
 
Core animation
Core animationCore animation
Core animation
 
tutorial5
tutorial5tutorial5
tutorial5
 
tutorial5
tutorial5tutorial5
tutorial5
 

Mehr von Victor Porof

Mehr von Victor Porof (11)

Firefox WebGL developer tools
Firefox WebGL developer toolsFirefox WebGL developer tools
Firefox WebGL developer tools
 
Firefox developer tools
Firefox developer toolsFirefox developer tools
Firefox developer tools
 
Js in the open
Js in the openJs in the open
Js in the open
 
Processing.js vs. three.js
Processing.js vs. three.jsProcessing.js vs. three.js
Processing.js vs. three.js
 
Javascript, Do you speak it!
Javascript, Do you speak it!Javascript, Do you speak it!
Javascript, Do you speak it!
 
Cityquest - Developing games for the mobile devices
Cityquest - Developing games for the mobile devicesCityquest - Developing games for the mobile devices
Cityquest - Developing games for the mobile devices
 
Web3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIWeb3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCI
 
Developing web apps using Java and the Play framework
Developing web apps using Java and the Play frameworkDeveloping web apps using Java and the Play framework
Developing web apps using Java and the Play framework
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
 
Introduction to the XNA framework
Introduction to the XNA frameworkIntroduction to the XNA framework
Introduction to the XNA framework
 
Introduction to 3D and shaders
Introduction to 3D and shadersIntroduction to 3D and shaders
Introduction to 3D and shaders
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Chameleon game engine

  • 1. Chameleon 3D game engine Tuesday, January 18, 2011
  • 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 features Tuesday, January 18, 2011
  • 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 slower Tuesday, January 18, 2011
  • 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. 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 platform Tuesday, January 18, 2011
  • 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 hardware Tuesday, January 18, 2011
  • 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. 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. 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. 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. Live coding/deployment ghter aircraft - model loading, environment, lighting, shadows Tuesday, January 18, 2011