WEB/WebGL

[WebGL] Three.js - 2DSprite 관련

AlrepondTech 2017. 11. 2. 00:24
반응형

 

 

 

 

 

=================================

=================================

=================================

 

 

 

 

 

 

 

출처: https://threejs.org/docs/#api/objects/Sprite

 

Sprite

A sprite is a plane that always faces towards the camera, generally with a partially transparent texture applied.

Sprites do not cast shadows, settingcastShadow = truewill have no effect.

Example

var spriteMap = new THREE.TextureLoader().load( "sprite.png" ); var spriteMaterial = new THREE.SpriteMaterial( { map: spriteMap, color: 0xffffff } ); var sprite = new THREE.Sprite( spriteMaterial ); scene.add( sprite );

Constructor

Sprite( material )

material - (optional) an instance of SpriteMaterial. Default is a white SpriteMaterial.

Creates a new Sprite.

Properties

See the base Object3D class for common properties.

.isSprite

Used to check whether this or derived classes are sprites. Default is true.

You should not change this, as it used internally for optimisation.

.material

An instance of SpriteMaterial, defining the object's appearance. Default is a white SpriteMaterial.

Methods

See the base Object3D class for common methods.

.clone ()

Returns a clone of this Sprite object and any descendants.

.raycast ( raycasterintersects )

Get intersections between a casted ray and this sprite. Raycaster.intersectObject will call this method.

Source

src/objects/Sprite.js

 

 

 

 

=================================

=================================

=================================

 

 

 

기타 링크모음

https://threejs.org/examples/webgl_sprites.html

 

https://github.com/timoxley/threejs/tree/master/examples/textures/sprites

 

https://stackoverflow.com/questions/43009719/webgl-three-js-how-to-display-a-sprite-error-uncaught-typeerror-cannot-rea

 

텍스쳐

http://www.johannes-raida.de/tutorials/three.js/tutorial06/tutorial06.htm

 

http://jsfiddle.net/greggman/MZpx8/

 

https://stackoverflow.com/questions/33803280/three-js-how-do-i-scaling-and-offset-my-image-textures

 

https://stackoverflow.com/questions/7919516/using-textures-in-three-js

 

https://www.packtpub.com/books/content/threejs-materials-and-texture

 

스프라이트

http://stemkoski.github.io/Three.js/Texture-Animation.html

 

https://videlais.com/2017/01/13/learning-three-js-part-3-loading-and-using-textures/

 

 

 

 

=================================

=================================

=================================

 

 

 

반응형