Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from defaultObject3D inflator to ThreeTagComponent
- Loading branch information
1 parent
b0da7c7
commit cb07e38
Showing
13 changed files
with
248 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
import { TagComponent } from "ecsy"; | ||
|
||
export class ThreeTagComponent extends TagComponent { | ||
static isThreeTagComponent = true; | ||
|
||
static matchesObject3D(object) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
import { ThreeTagComponent } from "./ThreeTagComponent"; | ||
|
||
// Tag components for every Object3D in the three.js core library | ||
|
||
// audio | ||
export class AudioTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.type === "Audio"; | ||
} | ||
} | ||
|
||
export class AudioListenerTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.type === "AudioListener"; | ||
} | ||
} | ||
|
||
export class PositionalAudioTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
// PositionalAudio doesn't have a type or isPositionalAudio property. | ||
return object.type === "Audio" && object.panner !== undefined; | ||
} | ||
} | ||
|
||
// cameras | ||
export class ArrayCameraTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isArrayCamera; | ||
} | ||
} | ||
|
||
export class CameraTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isCamera; | ||
} | ||
} | ||
|
||
export class CubeCameraTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.type === "CubeCamera"; | ||
} | ||
} | ||
|
||
export class OrthographicCameraTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isOrthographicCamera; | ||
} | ||
} | ||
|
||
export class PerspectiveCameraTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isPerspectiveCamera; | ||
} | ||
} | ||
|
||
// extras/objects | ||
export class ImmediateRenderObjectTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isImmediateRenderObject; | ||
} | ||
} | ||
|
||
// helpers | ||
|
||
// Due to inconsistency in implementing consistent identifying properties like "type" on helpers, we've | ||
// chosen to exclude helper tag components. | ||
|
||
// lights | ||
export class AmbientLightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isAmbientLight; | ||
} | ||
} | ||
|
||
export class AmbientLightProbeTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isAmbientLightProbe; | ||
} | ||
} | ||
|
||
export class DirectionalLightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isDirectionalLight; | ||
} | ||
} | ||
|
||
export class HemisphereLightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isHemisphereLight; | ||
} | ||
} | ||
|
||
export class HemisphereLightProbeTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isHemisphereLightProbe; | ||
} | ||
} | ||
|
||
export class LightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isLight; | ||
} | ||
} | ||
|
||
export class LightProbeTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isLightProbe; | ||
} | ||
} | ||
|
||
export class PointLightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isPointLight; | ||
} | ||
} | ||
|
||
export class RectAreaLightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isRectAreaLight; | ||
} | ||
} | ||
|
||
export class SpotLightTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isSpotLight; | ||
} | ||
} | ||
|
||
// objects | ||
export class BoneTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isBone; | ||
} | ||
} | ||
|
||
export class GroupTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isGroup; | ||
} | ||
} | ||
|
||
export class InstancedMeshTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isInstancedMesh; | ||
} | ||
} | ||
|
||
export class LODTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isLOD; | ||
} | ||
} | ||
|
||
export class LineTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isLine; | ||
} | ||
} | ||
|
||
export class LineLoopTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isLineLoop; | ||
} | ||
} | ||
|
||
export class LineSegmentsTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isLineSegments; | ||
} | ||
} | ||
|
||
export class MeshTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isMesh; | ||
} | ||
} | ||
export class PointsTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isPoints; | ||
} | ||
} | ||
|
||
export class SkinnedMeshTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isSkinnedMesh; | ||
} | ||
} | ||
|
||
export class SpriteTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isSprite; | ||
} | ||
} | ||
|
||
// scenes | ||
export class SceneTagComponent extends ThreeTagComponent { | ||
static matchesObject3D(object) { | ||
return object.isScene; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { Object3DComponent } from "./Object3DComponent"; | ||
export * from "./Object3DTags"; | ||
export * from "./ThreeTagComponents"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { Object3DComponent } from "./Object3DComponent.js"; | ||
export * from "./Object3DTags.js"; | ||
export { ThreeTagComponent } from "./ThreeTagComponent.js"; | ||
export { WebGLRendererComponent } from "./WebGLRendererComponent.js"; | ||
export * from "./ThreeTagComponents.js"; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters