Module: Mittsu

Defined in:
lib/mittsu/materials/shader_material.rb,
lib/mittsu/math.rb,
lib/mittsu/utils.rb,
lib/mittsu/version.rb,
lib/mittsu/math/ray.rb,
lib/mittsu/constants.rb,
lib/mittsu/math/box2.rb,
lib/mittsu/math/box3.rb,
lib/mittsu/core/clock.rb,
lib/mittsu/core/face3.rb,
lib/mittsu/math/color.rb,
lib/mittsu/math/euler.rb,
lib/mittsu/math/line3.rb,
lib/mittsu/math/plane.rb,
lib/mittsu/math/sphere.rb,
lib/mittsu/math/spline.rb,
lib/mittsu/math/vector.rb,
lib/mittsu/core/uniform.rb,
lib/mittsu/extras/image.rb,
lib/mittsu/lights/light.rb,
lib/mittsu/math/frustum.rb,
lib/mittsu/math/matrix3.rb,
lib/mittsu/math/matrix4.rb,
lib/mittsu/math/vector2.rb,
lib/mittsu/math/vector3.rb,
lib/mittsu/math/vector4.rb,
lib/mittsu/objects/line.rb,
lib/mittsu/objects/mesh.rb,
lib/mittsu/scenes/scene.rb,
lib/mittsu/core/geometry.rb,
lib/mittsu/loaders/cache.rb,
lib/mittsu/math/triangle.rb,
lib/mittsu/objects/group.rb,
lib/mittsu/cameras/camera.rb,
lib/mittsu/core/object_3d.rb,
lib/mittsu/core/raycaster.rb,
lib/mittsu/loaders/loader.rb,
lib/mittsu/objects/sprite.rb,
lib/mittsu/core/hash_array.rb,
lib/mittsu/math/quaternion.rb,
lib/mittsu/textures/texture.rb,
lib/mittsu/lights/area_light.rb,
lib/mittsu/lights/spot_light.rb,
lib/mittsu/extras/image_utils.rb,
lib/mittsu/lights/point_light.rb,
lib/mittsu/loaders/mtl_loader.rb,
lib/mittsu/loaders/obj_loader.rb,
lib/mittsu/loaders/stl_loader.rb,
lib/mittsu/materials/material.rb,
lib/mittsu/cameras/cube_camera.rb,
lib/mittsu/loaders/file_loader.rb,
lib/mittsu/math/color_keywords.rb,
lib/mittsu/objects/point_cloud.rb,
lib/mittsu/core/buffer_geometry.rb,
lib/mittsu/lights/ambient_light.rb,
lib/mittsu/loaders/image_loader.rb,
lib/mittsu/core/buffer_attribute.rb,
lib/mittsu/core/event_dispatcher.rb,
lib/mittsu/textures/cube_texture.rb,
lib/mittsu/textures/data_texture.rb,
lib/mittsu/loaders/obj_mtl_loader.rb,
lib/mittsu/textures/render_target.rb,
lib/mittsu/textures/video_texture.rb,
lib/mittsu/lights/hemisphere_light.rb,
lib/mittsu/loaders/loading_manager.rb,
lib/mittsu/lights/directional_light.rb,
lib/mittsu/materials/sprite_material.rb,
lib/mittsu/cameras/perspective_camera.rb,
lib/mittsu/cameras/orthographic_camera.rb,
lib/mittsu/textures/compressed_texture.rb,
lib/mittsu/textures/render_target_cube.rb,
lib/mittsu/extras/helpers/camera_helper.rb,
lib/mittsu/materials/mesh_face_material.rb,
lib/mittsu/core/dynamic_buffer_attribute.rb,
lib/mittsu/materials/line_basic_material.rb,
lib/mittsu/materials/mesh_basic_material.rb,
lib/mittsu/materials/mesh_phong_material.rb,
lib/mittsu/extras/geometries/box_geometry.rb,
lib/mittsu/materials/point_cloud_material.rb,
lib/mittsu/extras/geometries/ring_geometry.rb,
lib/mittsu/materials/mesh_lambert_material.rb,
lib/mittsu/extras/geometries/lathe_geometry.rb,
lib/mittsu/extras/geometries/plane_geometry.rb,
lib/mittsu/extras/geometries/torus_geometry.rb,
lib/mittsu/extras/geometries/circle_geometry.rb,
lib/mittsu/extras/geometries/sphere_geometry.rb,
lib/mittsu/extras/geometries/cylinder_geometry.rb,
lib/mittsu/extras/geometries/octahedron_geometry.rb,
lib/mittsu/extras/geometries/parametric_geometry.rb,
lib/mittsu/extras/geometries/polyhedron_geometry.rb,
lib/mittsu/extras/geometries/torus_knot_geometry.rb,
lib/mittsu/extras/geometries/icosahedron_geometry.rb,
lib/mittsu/extras/geometries/tetrahedron_geometry.rb,
lib/mittsu/extras/geometries/dodecahedron_geometry.rb,
lib/mittsu/extras/geometries/plane_buffer_geometry.rb,
lib/mittsu/extras/geometries/parametric_buffer_geometry.rb,
lib/mittsu/extras/geometries/torus_knot_buffer_geometry.rb

Overview

parameters =

color: <hex>,
opacity: <float>,
map: new THREE.Texture( <Image> ),

size: <float>,
sizeAttenuation: <bool>,

blending: THREE.NormalBlending,
depthTest: <bool>,
depthWrite: <bool>,

vertexColors: <bool>,

fog: <bool>

Defined Under Namespace

Modules: Cache, EventDispatcher, ImageUtils, Math Classes: AmbientLight, AreaLight, Box2, Box3, BoxGeometry, BufferAttribute, BufferGeometry, Camera, CameraHelper, CircleGeometry, Clock, Color, CompressedTexture, CubeCamera, CubeTexture, CylinderGeometry, DataTexture, DirectionalLight, DodecahedronGeometry, DynamicBufferAttribute, Euler, Face3, FileLoader, Frustum, Geometry, Group, HashArray, HemisphereLight, IcosahedronGeometry, Image, ImageLoader, LatheGeometry, Light, Line, Line3, LineBasicMaterial, Loader, LoadingManager, MTLLoader, Material, Matrix3, Matrix4, Mesh, MeshBasicMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshPhongMaterial, OBJLoader, OBJMTLLoader, Object3D, OctahedronGeometry, OrthographicCamera, ParametricBufferGeometry, ParametricGeometry, PerspectiveCamera, Plane, PlaneBufferGeometry, PlaneGeometry, PointCloud, PointCloudMaterial, PointLight, PolyhedronGeometry, Quaternion, Ray, Raycaster, RenderTarget, RenderTargetCube, RingGeometry, STLLoader, Scene, ShaderMaterial, Sphere, SphereGeometry, Spline, SpotLight, Sprite, SpriteMaterial, TetrahedronGeometry, Texture, TorusGeometry, TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, Uniform, Vector, Vector2, Vector3, Vector4, VideoTexture

Constant Summary collapse

DEBUG =
ENV["DEBUG"] == "true"
VERSION =
"0.5.0"
MOUSE_LEFT =
0
MOUSE_MIDDLE =
1
MOUSE_RIGHT =
2
CullFaceNone =

GL STATE CONSTANTS

0
CullFaceBack =
1
CullFaceFront =
2
CullFaceFrontBack =
3
FrontFaceDirectionCW =
0
FrontFaceDirectionCCW =
1
BasicShadowMap =

SHADOWING TYPES

0
PCFShadowMap =
1
PCFSoftShadowMap =
2
FrontSide =

side

0
BackSide =
1
DoubleSide =
2
NoShading =

shading

false
FlatShading =
1
SmoothShading =
2
NoColors =

colors

false
FaceColors =
1
VertexColors =
2
NoBlending =

blending modes

false
NormalBlending =
1
AdditiveBlending =
2
SubtractiveBlending =
3
MultiplyBlending =
4
CustomBlending =
5
AddEquation =

custom blending equations (numbers start from 100 not to clash with other

mappings to OpenGL constants defined in texture.rb)
100
SubtractEquation =
101
ReverseSubtractEquation =
102
MinEquation =
103
MaxEquation =
104
ZeroFactor =

custom blending destination factors

200
OneFactor =
201
SrcColorFactor =
202
OneMinusSrcColorFactor =
203
SrcAlphaFactor =
204
OneMinusSrcAlphaFactor =
205
DstAlphaFactor =
206
OneMinusDstAlphaFactor =
207
DstColorFactor =

ZeroFactor = 200 OneFactor = 201 SrcAlphaFactor = 204 OneMinusSrcAlphaFactor = 205 DstAlphaFactor = 206 OneMinusDstAlphaFactor = 207

208
OneMinusDstColorFactor =
209
SrcAlphaSaturateFactor =
210
MultiplyOperation =

TEXTURE CONSTANTS

0
MixOperation =
1
AddOperation =
2
UVMapping =

Mapping modes

300
CubeReflectionMapping =
301
CubeRefractionMapping =
302
EquirectangularReflectionMapping =
303
EquirectangularRefractionMapping =
304
SphericalReflectionMapping =
305
RepeatWrapping =

Wrapping modes

1000
ClampToEdgeWrapping =
1001
MirroredRepeatWrapping =
1002
NearestFilter =

Filters

1003
NearestMipMapNearestFilter =
1004
NearestMipMapLinearFilter =
1005
LinearFilter =
1006
LinearMipMapNearestFilter =
1007
LinearMipMapLinearFilter =
1008
UnsignedByteType =

Data types

1009
ByteType =
1010
ShortType =
1011
UnsignedShortType =
1012
IntType =
1013
UnsignedIntType =
1014
FloatType =
1015
HalfFloatType =
1025
UnsignedShort4444Type =

UnsignedByteType = 1009

1016
UnsignedShort5551Type =
1017
UnsignedShort565Type =
1018
AlphaFormat =

Pixel formats

1019
RGBFormat =
1020
RGBAFormat =
1021
LuminanceFormat =
1022
LuminanceAlphaFormat =
1023
RGBEFormat =

RGBEFormat handled as RGBAFormat in shaders

RGBAFormat
RGB_S3TC_DXT1_Format =

DDS / ST3C Compressed texture formats

2001
RGBA_S3TC_DXT1_Format =
2002
RGBA_S3TC_DXT3_Format =
2003
RGBA_S3TC_DXT5_Format =
2004
RGB_PVRTC_4BPPV1_Format =

PVRTC compressed texture formats

2100
RGB_PVRTC_2BPPV1_Format =
2101
RGBA_PVRTC_4BPPV1_Format =
2102
RGBA_PVRTC_2BPPV1_Format =
2103
LineStrip =
0
LinePieces =
1
ColorKeywords =
{
  'aliceblue' => 0xF0F8FF,
  'antiquewhite' => 0xFAEBD7,
  'aqua' => 0x00FFFF,
  'aquamarine' => 0x7FFFD4,
  'azure' => 0xF0FFFF,
  'beige' => 0xF5F5DC,
  'bisque' => 0xFFE4C4,
  'black' => 0x000000,
  'blanchedalmond' => 0xFFEBCD,
  'blue' => 0x0000FF,
  'blueviolet' => 0x8A2BE2,
  'brown' => 0xA52A2A,
  'burlywood' => 0xDEB887,
  'cadetblue' => 0x5F9EA0,
  'chartreuse' => 0x7FFF00,
  'chocolate' => 0xD2691E,
  'coral' => 0xFF7F50,
  'cornflowerblue' => 0x6495ED,
  'cornsilk' => 0xFFF8DC,
  'crimson' => 0xDC143C,
  'cyan' => 0x00FFFF,
  'darkblue' => 0x00008B,
  'darkcyan' => 0x008B8B,
  'darkgoldenrod' => 0xB8860B,
  'darkgray' => 0xA9A9A9,
  'darkgreen' => 0x006400,
  'darkgrey' => 0xA9A9A9,
  'darkkhaki' => 0xBDB76B,
  'darkmagenta' => 0x8B008B,
  'darkolivegreen' => 0x556B2F,
  'darkorange' => 0xFF8C00,
  'darkorchid' => 0x9932CC,
  'darkred' => 0x8B0000,
  'darksalmon' => 0xE9967A,
  'darkseagreen' => 0x8FBC8F,
  'darkslateblue' => 0x483D8B,
  'darkslategray' => 0x2F4F4F,
  'darkslategrey' => 0x2F4F4F,
  'darkturquoise' => 0x00CED1,
  'darkviolet' => 0x9400D3,
  'deeppink' => 0xFF1493,
  'deepskyblue' => 0x00BFFF,
  'dimgray' => 0x696969,
  'dimgrey' => 0x696969,
  'dodgerblue' => 0x1E90FF,
  'firebrick' => 0xB22222,
  'floralwhite' => 0xFFFAF0,
  'forestgreen' => 0x228B22,
  'fuchsia' => 0xFF00FF,
  'gainsboro' => 0xDCDCDC,
  'ghostwhite' => 0xF8F8FF,
  'gold' => 0xFFD700,
  'goldenrod' => 0xDAA520,
  'gray' => 0x808080,
  'green' => 0x008000,
  'greenyellow' => 0xADFF2F,
  'grey' => 0x808080,
  'honeydew' => 0xF0FFF0,
  'hotpink' => 0xFF69B4,
  'indianred' => 0xCD5C5C,
  'indigo' => 0x4B0082,
  'ivory' => 0xFFFFF0,
  'khaki' => 0xF0E68C,
  'lavender' => 0xE6E6FA,
  'lavenderblush' => 0xFFF0F5,
  'lawngreen' => 0x7CFC00,
  'lemonchiffon' => 0xFFFACD,
  'lightblue' => 0xADD8E6,
  'lightcoral' => 0xF08080,
  'lightcyan' => 0xE0FFFF,
  'lightgoldenrodyellow' => 0xFAFAD2,
  'lightgray' => 0xD3D3D3,
  'lightgreen' => 0x90EE90,
  'lightgrey' => 0xD3D3D3,
  'lightpink' => 0xFFB6C1,
  'lightsalmon' => 0xFFA07A,
  'lightseagreen' => 0x20B2AA,
  'lightskyblue' => 0x87CEFA,
  'lightslategray' => 0x778899,
  'lightslategrey' => 0x778899,
  'lightsteelblue' => 0xB0C4DE,
  'lightyellow' => 0xFFFFE0,
  'lime' => 0x00FF00,
  'limegreen' => 0x32CD32,
  'linen' => 0xFAF0E6,
  'magenta' => 0xFF00FF,
  'maroon' => 0x800000,
  'mediumaquamarine' => 0x66CDAA,
  'mediumblue' => 0x0000CD,
  'mediumorchid' => 0xBA55D3,
  'mediumpurple' => 0x9370DB,
  'mediumseagreen' => 0x3CB371,
  'mediumslateblue' => 0x7B68EE,
  'mediumspringgreen' => 0x00FA9A,
  'mediumturquoise' => 0x48D1CC,
  'mediumvioletred' => 0xC71585,
  'midnightblue' => 0x191970,
  'mintcream' => 0xF5FFFA,
  'mistyrose' => 0xFFE4E1,
  'moccasin' => 0xFFE4B5,
  'navajowhite' => 0xFFDEAD,
  'navy' => 0x000080,
  'oldlace' => 0xFDF5E6,
  'olive' => 0x808000,
  'olivedrab' => 0x6B8E23,
  'orange' => 0xFFA500,
  'orangered' => 0xFF4500,
  'orchid' => 0xDA70D6,
  'palegoldenrod' => 0xEEE8AA,
  'palegreen' => 0x98FB98,
  'paleturquoise' => 0xAFEEEE,
  'palevioletred' => 0xDB7093,
  'papayawhip' => 0xFFEFD5,
  'peachpuff' => 0xFFDAB9,
  'peru' => 0xCD853F,
  'pink' => 0xFFC0CB,
  'plum' => 0xDDA0DD,
  'powderblue' => 0xB0E0E6,
  'purple' => 0x800080,
  'red' => 0xFF0000,
  'rosybrown' => 0xBC8F8F,
  'royalblue' => 0x4169E1,
  'saddlebrown' => 0x8B4513,
  'salmon' => 0xFA8072,
  'sandybrown' => 0xF4A460,
  'seagreen' => 0x2E8B57,
  'seashell' => 0xFFF5EE,
  'sienna' => 0xA0522D,
  'silver' => 0xC0C0C0,
  'skyblue' => 0x87CEEB,
  'slateblue' => 0x6A5ACD,
  'slategray' => 0x708090,
  'slategrey' => 0x708090,
  'snow' => 0xFFFAFA,
  'springgreen' => 0x00FF7F,
  'steelblue' => 0x4682B4,
  'tan' => 0xD2B48C,
  'teal' => 0x008080,
  'thistle' => 0xD8BFD8,
  'tomato' => 0xFF6347,
  'turquoise' => 0x40E0D0,
  'violet' => 0xEE82EE,
  'wheat' => 0xF5DEB3,
  'white' => 0xFFFFFF,
  'whitesmoke' => 0xF5F5F5,
  'yellow' => 0xFFFF00,
  'yellowgreen' => 0x9ACD32
}
DefaultLoadingManager =
LoadingManager.new

Class Method Summary collapse

Class Method Details

.debug?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/mittsu/utils.rb', line 4

def self.debug?
  DEBUG
end

.envObject



8
9
10
# File 'lib/mittsu/utils.rb', line 8

def self.env
  ENV["MITTSU_ENV"]
end

.test?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/mittsu/utils.rb', line 12

def self.test?
  env == 'test'
end