Version 2.0.0-beta1
Pre-release
Pre-release
peteroupc
released this
04 Jan 18:32
·
294 commits
to master
since this release
Version 2.0.0-beta1:
There are many, many changes to version 2.0.0-beta1 from version 1.5.1. Here are some of them, including the most important ones.
- All classes in the main library are moved to a new namespace called
H3DU
. For example,Shape
is nowH3DU.Shape
andMesh
is nowH3DU.Mesh
. Many classes in the "extras" directory are also moved to theH3DU
namespace. Scene3D
, nowH3DU.Scene3D
, is no longer meant to be a scene graph of objects to draw. That job now belongs to the newH3DU.Batch3D
class. Scene3D'srender
method now takes an array ofBatch3D
s to render. For compatibility, though, the methods allowing it to manage 3D models and the coordinate system, such asmakeShape
andsetPerspective
, can still be used untilH3DU.Scene3D
renders a customH3DU.Batch3D
. This compatibility behavior may be dropped in the future.- Alpha is disabled in WebGL contexts created with the
H3DU.get3DOr2DContext
method. - The
Scene3D
H3DU.Scene3D#useProgram
method was deprecated and now does nothing. - New
H3DU.RenderPass3D
class holds information about how a batch of 3D models is to be rendered. It replaces theScene3D
H3DU.Scene3D#useFilter
method, which now does nothing. - New
H3DU.FrameBufferInfo
class holds information about a frame buffer; it replacesH3DU.FrameBuffer
. - The
BufferedMesh
,FrameBuffer
, andShaderProgram
classes are deprecated because they are too tightly coupled with a particular WebGL context. Instead, useH3DU.MeshBuffer
,H3DU.FrameBufferInfo
, andH3DU.ShaderInfo
, respectively, which are not coupled to WebGL contexts. - Rendering can make use of vertex array objects internally, if supported by the WebGL implementation.
- The
H3DU.Shape
object is no longer coupled to vertex buffers. - The
H3DU.LightSource
class now supports a radius of the light. - The
H3DU.TextureLoader
class was added for loading textures; a single object of this class can load and upload images from multiple WebGL contexts. This is unlikeBufferedMesh
,FrameBuffer
, andShaderProgram
, which are tied to the WebGL context. GLMath
, nowH3DU.Math
, was expanded with many new methods. The documentation for it is now very detailed. New methods includeH3DU.Math.vec3perp
,H3DU.Math.vec3toWindowPoint
, andH3DU.Math.mat4projectVec3
.- Two new classes in the "extras" folder support 2D text rendering and texture atlases (as sprite sheets), namely,
H3DU.TextFont
andH3DU.TextureAtlas
. - The "doc" folder contains the documentation to the library in the form of Markdown text files.
- The Camera class, now
H3DU.Camera
, was rewritten. - A build script was included in the repository. This build includes a style checker which is run on the library's JavaScript files.
- Many methods were added to many classes. Some methods that didn't return a value now return the value of the object called on, for example, the
clear
method ofH3DU.Scene3D
. - New demos, including spinbox.html and quatlerp.html. For example, the gears.html demo was moved from the separate "html-gears" repository to here. Other demos were expanded or rewritten. Viewport
meta
tags were added to the demos. - The underlying code used in
H3DU.toGLColor
was rewritten. In particular, the "#RRGGBBAA" format is now supported. - The JavaScript source code better conforms to a uniform code style.
- The experimental 2D canvas renderer in surfaces2d.html, was abandoned.
- Added
dispose
method toH3DU.Scene3D
. - Added
createPointedStar
andcreateLathe
methods toH3DU.Meshes
. - Added
getBounds
andtoLinePath
methods toH3DU.GraphicsPath
, an extra, as well
as an extra that adds methods that compute the intersection, difference, union, and XOR of two
polygons. Path triangulation now supports polygons with holes. - The default light configuration is no lights when creating a
H3DU.LightSource
. The exception, for compatibility purposes, is when using aH3DU.Scene3D
without rendering a customBatch3D
, in which case the default is one light source with its default values. - The default value for specular materials (
H3DU.Material
) is now (0.1, 0.1, 0.1). The default value for shininess is now 32. - The Mesh class no longer supports multiple primitive types (lines, triangles, points). Using different modes that use the same primitive type (for example, TRIANGLE_FAN and QUAD_STRIP) in the same mesh is still supported.
- Many of the tutorials were edited heavily to accommodate the new version. The
GraphicsPath
tutorial was added. - There were also numerous bug fixes.
- A known issue: When using the
H3DU.Camera
in conjunction with the compatibility behavior ofH3DU.Scene3D
, only one side of the scene will appear lighted by default.