Changes between Initial Version and Version 1 of Ticket #955


Ignore:
Timestamp:
03/24/11 14:09:22 (2 years ago)
Author:
ArcRiley
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #955

    • Property Status changed from new to assigned
    • Property Owner set to ArcRiley
  • Ticket #955 – Description

    initial v1  
    33After several attempts to improve it, and realizing that many of these prospective features conflict with each other, it's time to break it up into more refined classes, for now including Material, Textured, and Bumpmapped. 
    44 
    5 '''Material''' will have just the basic colors properties.  No textures, no cell shading, no adjustable shades beyond 0 (smooth) and 1 (flat), no blurring, no refraction, no metalic effects, and only the most basic alpha translucency. 
     5'''Material''' will be a plain greyish white material as the default for new faces. 
     6 
     7'''Colored''' will have just the basic colors properties.  No textures, no cell shading, no adjustable shades beyond 0 (smooth) and 1 (flat), no blurring, no refraction, no metalic effects, and only the most basic alpha translucency. 
    68 
    79'''Textured''' will inherit Material and add support for colormap and glowmap textures. 
     
    1315To accommodate this in a sane manner, the bind/unbind API needs to be replaced with a more flexible system: 
    1416 
    15 cdef int _render(self, int _pass, float* _texcoords, float* _tslvs) 
     17def virtual render (pass : int, texcoords : array of float, 
     18                        tslvs : array of float) : bool 
    1619 
    17 _pass is the pass number, starting with zero 
     20pass is the pass number, starting with zero 
    1821 
    19 _texcoords are the vertices' standard texcoords strided by 48 bytes, it's up to Material._render to set the pointer for any texture that needs this 
     22texcoords are the vertices' standard texcoords strided by 48 bytes, it's up to Material._render to set the pointer for any texture that needs this 
    2023 
    21 _tslvs are the Tangent-Space-Light-Vectors with a 0 stride.  This is needed for bumpmaps and possibly other types of materials (ie, for a chrome effect) 
     24tslvs are the Tangent-Space-Light-Vectors with a 0 stride.  This is needed for bumpmaps and possibly other types of materials (ie, for a chrome effect) 
    2225 
    23 If the function returns a 1, a render pass will done and this function called again.  0 is returned after a cleanup "pass" and is not followed by actual rendering.  Thus: 
     26If the function returns true, a render pass will done and this function called again.  False is returned if no further rendering or cleanup is needed.  Thus: 
    2427{{{ 
    25       _pass = 0 
    26       while (material._render(_pass, _texcoords, _tslvs) : 
    27         gl.glDrawElements (gl.GL_TRIANGLES,  
    28                            length * 3, 
    29                            gl.GL_UNSIGNED_SHORT,  
    30                            offset) 
    31         _pass += 1 
     28      pass = 0 
     29      while (material.render(pass, texcoords, tslvs): 
     30          gl.glDrawElements (gl.GL_TRIANGLES,  
     31                             length * 3, 
     32                             gl.GL_UNSIGNED_SHORT,  
     33                             offset) 
     34          pass += 1 
    3235}}} 
    3336 
    34 Each material is responsible for enabling each texture unit used, disabling those unused, setting the blend mode and function, enabling/disabling each of it's textures, and setting each of it's texture environment parameters.  
     37Each material is responsible for enabling each texture unit used, disabling those unused, setting the blend mode and function, enabling/disabling each of its textures, and setting each of its texture environment parameters.