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#Path JavaScript Examples
The following examples show how to use
three#Path.
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: edge.js From architect3d with MIT License | 5 votes |
// start, end have x and y attributes (i.e. corners)
makeWall(start, end, transform, invTransform, material)
{
var v1 = this.toVec3(start);
var v2 = this.toVec3(end);
var v3 = v2.clone();
var v4 = v1.clone();
v3.y = this.edge.getEnd().elevation;
v4.y = this.edge.getStart().elevation;
// v3.y = this.wall.getClosestCorner(end).elevation;
// v4.y = this.wall.getClosestCorner(start).elevation;
var points = [v1.clone(), v2.clone(), v3.clone(), v4.clone()];
points.forEach((p) => {p.applyMatrix4(transform);});
var spoints = [new Vector2(points[0].x, points[0].y),new Vector2(points[1].x, points[1].y),new Vector2(points[2].x, points[2].y),new Vector2(points[3].x, points[3].y)];
var shape = new Shape(spoints);
// add holes for each wall item
this.wall.items.forEach((item) => {
var pos = item.position.clone();
pos.applyMatrix4(transform);
var halfSize = item.halfSize;
var min = halfSize.clone().multiplyScalar(-1);
var max = halfSize.clone();
min.add(pos);
max.add(pos);
var holePoints = [new Vector2(min.x, min.y),new Vector2(max.x, min.y),new Vector2(max.x, max.y),new Vector2(min.x, max.y)];
shape.holes.push(new Path(holePoints));
});
var geometry = new ShapeGeometry(shape);
geometry.vertices.forEach((v) => {
v.applyMatrix4(invTransform);
});
// make UVs
var totalDistance = Utils.distance(new Vector2(v1.x, v1.z), new Vector2(v2.x, v2.z));
var height = this.wall.height;
geometry.faceVertexUvs[0] = [];
geometry.faces.forEach((face) => {
var vertA = geometry.vertices[face.a];
var vertB = geometry.vertices[face.b];
var vertC = geometry.vertices[face.c];
geometry.faceVertexUvs[0].push([vertexToUv(vertA),vertexToUv(vertB),vertexToUv(vertC)]);
});
geometry.faceVertexUvs[1] = geometry.faceVertexUvs[0];
geometry.computeFaceNormals();
geometry.computeVertexNormals();
function vertexToUv(vertex)
{
var x = Utils.distance(new Vector2(v1.x, v1.z), new Vector2(vertex.x, vertex.z)) / totalDistance;
var y = vertex.y / height;
return new Vector2(x, y);
}
var mesh = new Mesh(geometry, material);
mesh.name = 'wall';
return mesh;
}