File

projects/atft/src/lib/object/mesh/torus-mesh.component.ts

Extends

AbstractMesh

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(rendererService: RendererService, parent: AbstractObject3D<any>)
Parameters :
Name Type Optional
rendererService RendererService No
parent AbstractObject3D<any> No

Inputs

arc
Type : number
Default value : Math.PI * 2
radialSegments
Type : number
Default value : 8
radius
Type : number
Default value : 0.4

Radius of the torus, from the center of the torus to the center of the tube

tube
Type : number

Radius of the tube.

tubularSegments
Type : number
Default value : 6
castShadow
Type : boolean
Default value : true
Inherited from AbstractMesh
Defined in AbstractMesh:16
depthWrite
Type : boolean
Default value : true
Inherited from AbstractMesh
Defined in AbstractMesh:22
material
Type : string
Inherited from AbstractMesh
Defined in AbstractMesh:10
materialColor
Type : string | number
Default value : '#5DADE2'
Inherited from AbstractMesh
Defined in AbstractMesh:13
receiveShadow
Type : boolean
Default value : true
Inherited from AbstractMesh
Defined in AbstractMesh:19
layer
Type : number
Default value : 0
Inherited from AbstractObject3D
name
Type : string
Default value : uuidv4()
Inherited from AbstractObject3D
rotateX
Type : number
Inherited from AbstractObject3D

Rotation in Euler angles (radians) with order X, Y, Z.

rotateY
Type : number
Inherited from AbstractObject3D
rotateZ
Type : number
Inherited from AbstractObject3D
scaleX
Type : number
Default value : 1
Inherited from AbstractObject3D
scaleY
Type : number
Default value : 1
Inherited from AbstractObject3D
scaleZ
Type : number
Default value : 1
Inherited from AbstractObject3D
translateX
Type : number
Inherited from AbstractObject3D

Translate the geometry. This is typically done as a one time operation, and not during a loop.

translateY
Type : number
Inherited from AbstractObject3D
translateZ
Type : number
Inherited from AbstractObject3D

Outputs

changed
Type : EventEmitter
Inherited from AbstractObject3D

Methods

Protected newObject3DInstance
newObject3DInstance()
Inherited from AbstractObject3D
Returns : THREE.Mesh
Public applyMaterial
applyMaterial()
Inherited from AbstractMesh
Defined in AbstractMesh:50
Returns : void
Protected applyShadowProps
applyShadowProps(mesh: THREE.Mesh)
Inherited from AbstractMesh
Defined in AbstractMesh:28
Parameters :
Name Type Optional
mesh THREE.Mesh No
Returns : void
Protected getMaterial
getMaterial()
Inherited from AbstractMesh
Defined in AbstractMesh:24
Returns : THREE.Material
Public ngOnChanges
ngOnChanges(changes: SimpleChanges)
Inherited from AbstractObject3D
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
Public addChild
addChild(object: AbstractObject3D<any>)
Inherited from AbstractObject3D
Parameters :
Name Type Optional
object AbstractObject3D<any> No
Returns : void
Protected afterInit
afterInit()
Inherited from AbstractObject3D
Returns : void
Public applyRotation
applyRotation()
Inherited from AbstractObject3D
Returns : void
Public applyScale
applyScale()
Inherited from AbstractObject3D
Returns : void
Public applyTranslation
applyTranslation()
Inherited from AbstractObject3D
Returns : void
Public findByName
findByName(name: string)
Inherited from AbstractObject3D
Parameters :
Name Type Optional
name string No
Returns : any
Public getChildren
getChildren()
Inherited from AbstractObject3D
Public getObject
getObject()
Inherited from AbstractObject3D
Returns : T
Public ngAfterViewInit
ngAfterViewInit()
Inherited from AbstractObject3D
Returns : void
Public ngOnDestroy
ngOnDestroy()
Inherited from AbstractObject3D
Returns : void
Public ngOnInit
ngOnInit()
Inherited from AbstractObject3D
Returns : void
Protected recursionByName
recursionByName(currentNode: AbstractObject3D<any>, name: string)
Inherited from AbstractObject3D
Parameters :
Name Type Optional
currentNode AbstractObject3D<any> No
name string No
Returns : any
Public removeChild
removeChild(object: AbstractObject3D<any>)
Inherited from AbstractObject3D
Parameters :
Name Type Optional
object AbstractObject3D<any> No
Returns : void
Public removeChildByName
removeChildByName(name: string)
Inherited from AbstractObject3D
Parameters :
Name Type Optional
name string No
Returns : void
Public updateParent
updateParent()
Inherited from AbstractObject3D
Returns : void

Properties

Protected childlren
Type : Array<AbstractObject3D<any>>
Default value : []
Inherited from AbstractObject3D
Protected object
Type : T
Inherited from AbstractObject3D
import { Component, Input, Optional, SkipSelf } from '@angular/core';
import * as THREE from 'three';
import { RendererService } from '../../renderer/renderer.service';
import { provideParent } from '../../util';
import { AbstractObject3D } from '../abstract-object-3d';
import { AbstractMesh } from './abstract-mesh-3d';

@Component({
  selector: 'atft-torus-mesh',
  providers: [provideParent(TorusMeshComponent)],
  template: '<ng-content></ng-content>'
})
export class TorusMeshComponent extends AbstractMesh {

  /**
   * Radius of the torus, from the center of the torus to the center of the tube
   */
  @Input() radius = 0.4;

  /**
   * Radius of the tube.
   */
  @Input()
  tube!: number;

  @Input()
  radialSegments = 8;

  @Input()
  tubularSegments = 6;

  @Input()
  arc: number = Math.PI * 2;

  constructor(
    protected override rendererService: RendererService,
    @SkipSelf() @Optional() protected override parent: AbstractObject3D<any>
  ) {
    super(rendererService, parent);
  }

  protected newObject3DInstance(): THREE.Mesh {
    this.radius *= 1;
    this.tube *= 1;
    this.radialSegments *= 1;
    this.tubularSegments *= 1;

    const geometry = new THREE.TorusGeometry(this.radius, this.tube,
      this.radialSegments, this.tubularSegments);
    const material = this.getMaterial();
    const mesh = new THREE.Mesh(geometry, material);
    this.applyShadowProps(mesh);
    return mesh;
  }

}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""