three APIs
- Vector3
- Mesh
- Vector2
- Color
- Matrix4
- PerspectiveCamera
- MeshBasicMaterial
- Scene
- ShaderMaterial
- BufferGeometry
- Quaternion
- Object3D
- LineBasicMaterial
- TextureLoader
- EventDispatcher
- DoubleSide
- LineSegments
- FileLoader
- UniformsUtils
- Vector4
- Box3
- Group
- DirectionalLight
- BufferAttribute
- MathUtils
- NearestFilter
- LinearFilter
- Spherical
- OrthographicCamera
- WebGLRenderer
- BackSide
- Float32BufferAttribute
- MeshPhongMaterial
- Points
- MOUSE
- WebGLRenderTarget
- AmbientLight
- MeshStandardMaterial
- PlaneBufferGeometry
- BoxGeometry
- Raycaster
- FrontSide
- Sphere
- Loader
- PointsMaterial
- TOUCH
- sRGBEncoding
- AdditiveBlending
- Line
- RepeatWrapping
- RGBAFormat
- RGBFormat
- Plane
- ClampToEdgeWrapping
- ShaderLib
- UniformsLib
- Clock
- FloatType
- UnsignedByteType
- BoxBufferGeometry
- Euler
- Texture
- VertexColors
- InterleavedBufferAttribute
- Material
- DepthTexture
- PCFSoftShadowMap
- Matrix3
- LinearMipmapLinearFilter
- LoaderUtils
- AnimationClip
- Bone
- PointLight
- QuaternionKeyframeTrack
- Skeleton
- SkinnedMesh
- SpotLight
- VectorKeyframeTrack
- NearestMipmapLinearFilter
- DataTextureLoader
- HalfFloatType
- LinearEncoding
- RawShaderMaterial
- CanvasTexture
- Geometry
- MeshNormalMaterial
- DataTexture
- ShaderChunk
- Shape
- SphereGeometry
- SphereBufferGeometry
- HemisphereLight
- FogExp2
- Box3Helper
- InstancedMesh
- Frustum
- Curve
- MirroredRepeatWrapping
- MeshLambertMaterial
- NumberKeyframeTrack
- PropertyBinding
- InterleavedBuffer
- Interpolant
- InterpolateDiscrete
- InterpolateLinear
- LineLoop
- LinearMipmapNearestFilter
- MeshPhysicalMaterial
- NearestMipmapNearestFilter
- TangentSpaceNormalMap
- TriangleFanDrawMode
- TriangleStripDrawMode
- RGBEEncoding
- RGBEFormat
- NoBlending
- PlaneGeometry
- Face3
- AxesHelper
- Uniform
- MeshDepthMaterial
- RGBADepthPacking
- LuminanceFormat
- DepthStencilFormat
- UnsignedInt248Type
- NearestMipMapLinearFilter
- BufferGeometryLoader
- ExtrudeBufferGeometry
- ShapeBufferGeometry
- InstancedInterleavedBuffer
- Line3
- InstancedBufferGeometry
- WireframeGeometry
- NoColors
- LoadingManager
- CameraHelper
- CylinderBufferGeometry
- TorusBufferGeometry
- GridHelper
- RingBufferGeometry
- DefaultLoadingManager
- Ray
- EquirectangularReflectionMapping
- Uint16BufferAttribute
- TrianglesDrawMode
- LinearMipMapLinearFilter
- BoxHelper
- Triangle
- ShapeGeometry
- JSONLoader
- Path
- CylinderGeometry
- ImageUtils
- CompressedTextureLoader
- RGBA_S3TC_DXT3_Format
- RGBA_S3TC_DXT5_Format
- RGB_ETC1_Format
- RGB_S3TC_DXT1_Format
- CurvePath
- EdgesGeometry
- DynamicDrawUsage
- StaticDrawUsage
- RedFormat
- AddEquation
- CustomBlending
- DstAlphaFactor
- DstColorFactor
- UnsignedShortType
- ZeroFactor
- NormalBlending
- SrcAlphaFactor
- OneMinusSrcAlphaFactor
- UnsignedIntType
- WebGLMultisampleRenderTarget
- Camera
- IcosahedronBufferGeometry
- LineDashedMaterial
- CircleGeometry
OtherRelated APIs
three#StaticDrawUsage JavaScript Examples
The following examples show how to use
three#StaticDrawUsage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugDrawer.js From three-fps with MIT License | 5 votes |
constructor(scene, world, options = {}) {
this.scene = scene;
this.world = world;
this.options = options;
this.debugDrawMode = options.debugDrawMode || AmmoDebugConstants.DrawWireframe;
const drawOnTop = this.debugDrawMode & AmmoDebugConstants.DrawOnTop || false;
const maxBufferSize = options.maxBufferSize || 1000000;
this.geometry = new BufferGeometry()
const vertices = new Float32Array(maxBufferSize * 3)
const colors = new Float32Array(maxBufferSize * 3)
/*
I do not know the difference, just using the first one.
export const StaticDrawUsage: Usage;
export const DynamicDrawUsage: Usage;
export const StreamDrawUsage: Usage;
export const StaticReadUsage: Usage;
export const DynamicReadUsage: Usage;
export const StreamReadUsage: Usage;
export const StaticCopyUsage: Usage;
export const DynamicCopyUsage: Usage;
export const StreamCopyUsage: Usage;
*/
this.geometry.setAttribute('position', new BufferAttribute(vertices, 3).setUsage(StaticDrawUsage))
this.geometry.setAttribute('color', new BufferAttribute(colors, 3).setUsage(StaticDrawUsage))
this.index = 0
const material = new LineBasicMaterial({
vertexColors: true,
depthTest: !drawOnTop
});
this.mesh = new LineSegments(this.geometry, material);
if (drawOnTop) this.mesh.renderOrder = 999;
this.mesh.frustumCulled = false;
this.enabled = false;
this.debugDrawer = new Ammo.DebugDrawer();
this.debugDrawer.drawLine = this.drawLine.bind(this);
this.debugDrawer.drawContactPoint = this.drawContactPoint.bind(this);
this.debugDrawer.reportErrorWarning = this.reportErrorWarning.bind(this);
this.debugDrawer.draw3dText = this.draw3dText.bind(this);
this.debugDrawer.setDebugMode = this.setDebugMode.bind(this);
this.debugDrawer.getDebugMode = this.getDebugMode.bind(this);
this.world.setDebugDrawer(this.debugDrawer);
}