-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from jbbe/add-MeshDepthMaterial
Initial implementation of MeshDepthMaterial issue #77
- Loading branch information
Showing
4 changed files
with
104 additions
and
111 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @author jbbe / https://github.com/jbbe | ||
*/ | ||
|
||
import {MeshDepthMaterial} from './MeshDepthMaterial' | ||
|
||
describe('Materials', () => { | ||
describe('MeshDepthMaterial', () => { | ||
test('type', () => { | ||
const mat = new MeshDepthMaterial() | ||
expect(mat.type).toBe('MeshDepthMaterial', 'it should be true') | ||
}) | ||
|
||
todo('copy') | ||
}) | ||
}) |
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,88 @@ | ||
import {Material} from './Material.js' | ||
import {BasicDepthPacking, DepthPackingStrategies} from '../constants.js' | ||
import {Texture} from '../textures/Texture.js' | ||
|
||
/** | ||
* @author mrdoob / http://mrdoob.com/ | ||
* @author alteredq / http://alteredqualia.com/ | ||
* @author bhouston / https://clara.io | ||
* @author WestLangley / http://github.com/WestLangley | ||
* | ||
* parameters = { | ||
* | ||
* opacity: <float>, | ||
* | ||
* map: new THREE.Texture( <Image> ), | ||
* | ||
* alphaMap: new THREE.Texture( <Image> ), | ||
* | ||
* displacementMap: new THREE.Texture( <Image> ), | ||
* displacementScale: <float>, | ||
* displacementBias: <float>, | ||
* | ||
* wireframe: <boolean>, | ||
* wireframeLinewidth: <float> | ||
* } | ||
*/ | ||
|
||
// export interface MeshDepthMaterialParameters extends MaterialParameters { | ||
// depthPacking?: DepthPackingStrategies | ||
// displacementMap?: Texture | ||
// displacementScale?: f32 | ||
// displacementBias?: f32 | ||
// wireframe?: boolean | ||
// wireframeLinewidth?: f32 | ||
// } | ||
|
||
export class MeshDepthMaterial extends Material { | ||
isMeshDepthMaterial = true | ||
|
||
depthPacking: DepthPackingStrategies = BasicDepthPacking | ||
|
||
skinning: Boolean = false | ||
morphTargets: Boolean = false | ||
|
||
map: Texture | null = null | ||
|
||
alphaMap: Texture | null = null | ||
|
||
displacementMap: Texture | null = null | ||
displacementScale: f32 = 1 | ||
displacementBias: f32 = 0 | ||
|
||
wireframe: boolean = false | ||
wireframeLinewidth: f32 = 1 | ||
|
||
fog: boolean = false | ||
lights: boolean = false | ||
|
||
constructor(/*parameters: MeshDepthMaterialParameters*/) { | ||
super() | ||
this.type = 'MeshDepthMaterial' | ||
} | ||
|
||
/** | ||
* Copy the properties from the passed material into this material. | ||
*/ | ||
copy(source: MeshDepthMaterial): this { | ||
Material.prototype.copy.call(this, source) | ||
|
||
this.depthPacking = source.depthPacking | ||
|
||
this.skinning = source.skinning | ||
this.morphTargets = source.morphTargets | ||
|
||
this.map = source.map | ||
|
||
this.alphaMap = source.alphaMap | ||
|
||
this.displacementMap = source.displacementMap | ||
this.displacementScale = source.displacementScale | ||
this.displacementBias = source.displacementBias | ||
|
||
this.wireframe = source.wireframe | ||
this.wireframeLinewidth = source.wireframeLinewidth | ||
|
||
return this | ||
} | ||
} |