Class: BasicMaterial

BasicMaterial

new BasicMaterial(params)

基础材质,支持 NONE, PHONG, BLINN-PHONG, LAMBERT光照模型

Name Type Description
params object

初始化参数,所有params都会复制到实例上

Example
const material = new Hilo3d.BasicMaterial({
    diffuse: new Hilo3d.Color(1, 0, 0, 1)
});

Extends

Members Show Inherited

Name Type Default Description
isBasicMaterial boolean true
className string BasicMaterial
lightType string BLINN-PHONG

光照类型,支持: NONE, PHONG, BLINN-PHONG, LAMBERT

diffuse Texture | Color Color(.5, .5, .5)

漫反射贴图,或颜色

ambient Texture | Color null

环境光贴图,或颜色

specular Texture | Color Color(1, 1, 1)

镜面贴图,或颜色

emission Texture | Color Color(0, 0, 0)

放射光贴图,或颜色

specularEnvMap CubeTexture | Texture null

环境贴图

specularEnvMatrix Matrix4 null

环境贴图变化矩阵,如旋转等

reflectivity number 0

反射率

refractRatio number 0

折射比率

refractivity number 0

折射率

shininess number 32

高光发光值

isMaterial boolean true inherited
shaderCacheId String null inherited

shader cache id

wireframe boolean false inherited

是否开启网格模式

depthTest boolean true inherited

是否开启深度测试

sampleAlphaToCoverage Boolean false inherited

SAMPLE_ALPHA_TO_COVERAGE

depthMask boolean true inherited

是否开启depthMask

depthRange Array [0, 1] inherited

深度测试Range

depthFunc GLenum LESS inherited

深度测试方法

normalMap Texture null inherited

法线贴图

parallaxMap Texture null inherited

视差贴图

normalMapScale float 1 inherited

法线贴图scale

ignoreTranparent Boolean false inherited

是否忽略透明度

gammaCorrection Boolean false inherited

是否开启 gamma 矫正

usePhysicsLight Boolean false inherited

是否使用物理灯光

renderOrder Number 0 inherited

渲染顺序数字小的先渲染(透明物体和不透明在不同的队列)

premultiplyAlpha Boolean true inherited

是否预乘 alpha

gammaOutput Boolean false inherited

gammaOutput

gammaFactor Number 2.2 inherited

gamma值

castShadows Boolean true inherited

是否投射阴影

receiveShadows Boolean true inherited

是否接受阴影

uvMatrix Matrix3 inherited

uv transform eg:new Matrix3().fromRotationTranslationScale(Math.PI/2, 0, 0, 2, 2)

uvMatrix1 Matrix3 inherited

uv1 transform eg:new Matrix3().fromRotationTranslationScale(Math.PI/2, 0, 0, 2, 2)

cullFace boolean true inherited

是否开启 CullFace

cullFaceType GLenum BACK inherited

CullFace 类型

side GLenum FRONT inherited

显示面,可选值 FRONT, BACK, FRONT_AND_BACK

blend boolean false inherited

是否开启颜色混合

blendEquation GLenum FUNC_ADD inherited

颜色混合方式

blendEquationAlpha GLenum FUNC_ADD inherited

透明度混合方式

blendSrc GLenum ONE inherited

颜色混合来源比例

blendDst GLenum ZERO inherited

颜色混合目标比例

blendSrcAlpha GLenum ONE inherited

透明度混合来源比例

blendDstAlpha GLenum ONE inherited

透明度混合目标比例

isDirty boolean false inherited

当前是否需要强制更新

transparency number 1 inherited

透明度 0~1

transparent boolean false inherited

是否需要透明

alphaCutoff number 0 inherited

透明度剪裁,如果渲染的颜色透明度大于等于这个值的话渲染为完全不透明,否则渲染为完全透明

useHDR Boolean false inherited

是否使用HDR

exposure Number 1 inherited

曝光度,仅在 useHDR 为 true 时生效

needBasicUnifroms Boolean true inherited

是否需要加基础 uniforms

needBasicAttributes Boolean true inherited

是否需要加基础 attributes

id string inherited
uniforms object {} inherited

可以通过指定,semantic来指定值的获取方式,或者自定义get方法

attributes object {} inherited

可以通过指定,semantic来指定值的获取方式,或者自定义get方法

Methods Show Inherited

inherited addBasicAttributes()

增加基础 attributes

增加基础 uniforms

inherited addTextureUniforms(textureUniforms)

增加贴图 uniforms

Name Type Description
textureUniforms Object

textureName:semanticName 键值对

inherited getRenderOption(option){Object}

获取渲染选项值

Name Type Default Description
option Object {} optional

渲染选项值

Returns:
Type Description
Object 渲染选项值

clone 当前Material

Returns:
Type Description
Material 返回clone的Material

销毁贴图

Returns:
Type Description
Material this

获取材质全部贴图

Returns:
Type Description
Array.<Texture>