Changeset 32676 in project


Ignore:
Timestamp:
08/08/15 17:55:45 (5 years ago)
Author:
acharlton
Message:

wiki/hypergiant: Update to 0.4.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/hypergiant

    r32619 r32676  
    1 
    21== Hypergiant
    32[[toc:]]
     
    2625* srfi-99
    2726
    28 While Hypergiant doesn’t require any external libraries directly, opengl-glew and glfw3 depend on OpenGL, [[http://glew.sourceforge.net/|GLEW]], [[http://www.glfw.org/|GLFW]] (the most recent major version is required: 3.X).
     27While Hypergiant doesn’t require any external libraries directly, opengl-glew and glfw3 depend on OpenGL, [[http://glew.sourceforge.net/|GLEW]], [[http://www.glfw.org/|GLFW]] (the most recent major version is required: 3.X). gl-type depends on [[http://www.freetype.org/|Freetype]]
    2928
    3029When installing GLFW on OS X through Homebrew, an extra step is needed. Homebrew renames the library’s from the default. You can fix this by creating a link that points to the library that gets installed. E.g. {{sudo ln -s <homebrew-lib-dir>/glfw3.dylib /usr/local/lib/glfw.dylib}}
     
    3837* Intuitive control of input events, namely mouse and keyboard events (joystick support to come)
    3938* Creation of geometric primitives as well as animated sprites
     39* [[http://sauerbraten.org/iqm/|IQM]] model loading and animation
    4040* A particle system
    4141* Simple shaders to make simple visualization easy
     
    406406This function replaces {{set-max-lights!}}, from Hyperscene. It should be used in the same way. The only difference is that this function selects an appropriate {{phong-lighting}} shader based on the number of lights set. The {{phong-lighting}} shaders differ in the array size of the uniforms, and an appropriate {{N}} value should be used in the uniforms of any pipeline using {{phong-lighting}}: the size of each uniform array should be greater than or equal to {{N}} and a power of 2 from 8 to 64.
    407407
     408<constant> Shader: calc-bone-matrix</constant>
     409
     410'''Uniforms'''
     411
     412    ((bone-matrices (#:array #:mat4 100)))
     413
     414Note that this uniform is automatically provided when creating an animated model with {{add-new-animated-model}}.
     415
     416'''Exports'''
     417
     418    (calc-bone-matrix (BONE-INDICES #:vec4) (BONE-WEIGHTS #:vec3)) -> #:mat4
     419
     420This shader function calculates the matrix resulting from taking the given {{BONE-INDICES}} and {{BONE-WEIGHTS}} and summing the weighted matrices taken from the uniform {{bone-matrices}} array.
     421
     422Here’s a simple shader using this shader:
     423
     424<enscript highlight="scheme">   
     425(define-pipeline bone-pipeline
     426  ((#:vertex input: ((position #:vec3) (tex-coord #:vec2)
     427                     (blend-indexes #:vec4) (blend-weights #:vec4))
     428             uniform: ((mvp #:mat4)
     429                       (bone-matrices (#:array #:mat4 100)))
     430             use: (calc-bone-matrix)
     431             output: ((tex-c #:vec2)))
     432   (define (main) #:void
     433     (set! gl:position (* mvp
     434                          (calc-bone-matrix blend-indexes
     435                                            blend-weights)
     436                          (vec4 position 1.0)))
     437     (set! tex-c tex-coord)))
     438  ((#:fragment input: ((tex-c #:vec2))
     439               uniform: ((tex #:sampler-2d))
     440           output: ((frag-color #:vec4)))
     441   (define (main) #:void
     442     (set! frag-color (texture tex tex-c)))))
     443</enscript>
     444
    408445
    409446==== Geometry
     
    497534
    498535Update the {{ANIMATED-SPRITE}} given the time interval {{DELTA}}, changing the current frame of the sprite if enough time has elapsed since the last frame. This should be called every frame that the {{ANIMATED-SPRITE}} is to be animated.
     536
     537
     538==== Inter-Quake Models
     539[[http://sauerbraten.org/iqm/|Inter-Quake Models]] are an open standard for rigged models, with support across a range of tools. Hypergiant supports their loading, and creating meshes and animated models with the resulting IQM objects.
     540
     541<procedure> (load-iqm IQM-FILE [BASE-IQM])</procedure>
     542
     543Load an IQM record from the given {{IQM-FILE}}. For IQM files that only provide an animation, a {{BASE-IQM}} is necessary in order to generate a Hypergiant animation object. When {{load-iqm}} is called with a {{BASE-IQM}}, any animations created are added to the {{BASE-IQM}}.
     544
     545<record> (iqm meshes vertex-arrays n-vertexes n-triangles triangles adjacencies joints animations flags comment)</record>
     546
     547The record created by {{load-iqm}}.
     548
     549<parameter> iqm-global-flags</parameter>
     550
     551An alist of flags that are recognized by {{load-iqm}}. Defaults to {{()}}.
     552
     553<parameter> vertex-array-flags</parameter>
     554
     555An alist of vertex-array flags that are recognized by {{load-iqm}}. Defaults to {{()}}.
     556
     557<parameter> animation-flags</parameter>
     558
     559An alist of animation flags that are recognized by {{load-iqm}}. Defaults to {{((#:loop . 1))}}.
     560
     561<procedure> (iqm->mesh IQM ATTRIBUTES)</procedure>
     562
     563Create a mesh from the given IQM object, with the provided list of ATTRIBUTES. This creates a mesh using all of the vertices of the IQM.
     564
     565<procedure> (iqm->meshes IQM ATTRIBUTES)</procedure>
     566
     567Create a list of mesh for each mesh defined in the given IQM object, with the provided list of ATTRIBUTES.
     568
     569<parameter> normalized-attributes</parameter>
     570
     571A list of attribute symbols which should be normalized when creating a mesh from an IQM (with {{iqm->mesh(s)}}). Defaults to {{(blend-weights color)}}.
     572
     573
     574==== Animated models
     575Animated models are an opaque object similar to animated sprites, but for rigged models. Animated models are used with the same animation getting and setting functions as [[http://wiki.call-cc.org/eggref/4/hypergiant#animated-sprites|animated sprites]], i.e. {{current-animation}} and {{set-animation!}}. Animations suitable for animated models are created when loading IQM files containing animations (which can be referenced with {{iqm-animations}}).
     576
     577<procedure> (add-new-animated-model PARENT PIPELINE mesh: MESH base-animation: BASE-ANIMATION . ARGS)</procedure>
     578
     579Extends {{add-node}}, returning an animated model object. This function requires the following keyword arguments: {{MESH}}, a mesh corresponding to the IQM (made with e.g. {{iqm->mesh}}), {{BASE-ANIMATION}} the initial animation to use for the animated model.
     580
     581<procedure> (update-animated-model! ANIMATED-MODEL DELTA)</procedure>
     582
     583Update the {{ANIMATED-MODEL}} given the time interval {{DELTA}}, changing the current frame of the model if enough time has elapsed since the last frame, tweening between frames. This should be called every frame that the {{ANIMATED-MODEL}} is to be animated.
    499584
    500585
     
    607692<procedure> (next-power-of-two N)</procedure>
    608693
    609 Returns the next power of two for the positive integer {{N}}.
     694Returns the next power of two for the positive integer {{n}}.
    610695
    611696<procedure> (clamp X LOWER UPPER)</procedure>
     
    669754=== Version history
    670755
     756==== Version 0.4.0
     7578 August 2015
     758
     759Make sure gl-math is up to date before updating Hypergiant.
     760
     761* Add Inter-Quake Model loading and animation
     762* Support for Retina displays
     763
     764
    671765==== Version 0.3.0
    67276623 January 2015
Note: See TracChangeset for help on using the changeset viewer.