Class: GeometryMaterial

GeometryMaterial

new GeometryMaterial(params)

几何材质,支持 POSITION, NORMAL, DEPTH, DISTANCE 顶点类型

Name Type Description
params object optional

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

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

Extends

Members Show Inherited

Name Type Default Description
isGeometryMaterial boolean true
className string GeometryMaterial
vertexType String

顶点类型 POSITION, NORMAL, DEPTH, DISTANCE

writeOriginData Boolean

是否直接存储

isBasicMaterial boolean true inherited
lightType 'NONE' | 'PHONG' | 'BLINN-PHONG' | 'LAMBERT' BLINN-PHONG inherited

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

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

漫反射贴图,或颜色

ambient Texture | Color null inherited

环境光贴图,或颜色

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

镜面贴图,或颜色

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

放射光贴图,或颜色

specularEnvMap CubeTexture | Texture null inherited

环境贴图

specularEnvMatrix Matrix4 null inherited

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

reflectivity number 0 inherited

反射率

refractRatio number 0 inherited

折射比率

refractivity number 0 inherited

折射率

shininess number 32 inherited

高光发光值

isMaterial boolean true inherited
name string inherited

name

shaderCacheId string null inherited

shader cache id

shaderName string null inherited

shader name,会在 shader 中加个 SHADER_NAME 宏,不填用 className 代替。

wireframe boolean false inherited

是否开启网格模式

frontFace GLenum CCW inherited

front face winding orientation

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 Number 1 inherited

法线贴图scale

ignoreTranparent Boolean false inherited

是否忽略透明度

gammaCorrection Boolean false inherited

是否开启 gamma 矫正

usePhysicsLight Boolean false inherited

是否使用物理灯光

isDiffuesEnvAndAmbientLightWorkTogether Boolean false inherited

是否环境贴图和环境光同时生效

userData any null 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

透明度混合目标比例

stencilTest boolean 1 inherited

stencilTest

stencilMask number 0xff inherited

stencilMask

stencilFunc GLenum ALWAYS inherited

stencilFunc func

stencilFuncRef number 1 inherited

stencilFunc ref

stencilFuncMask number 0xff inherited

stencilFunc mask

stencilOpFail GLenum KEEP inherited

stencilOp fail

stencilOpZFail GLenum KEEP inherited

stencilOp zfail

stencilOpZPass GLenum KEEP inherited

stencilOp zpass

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 时生效

enableTextureLod Boolean false inherited

是否开启 texture lod

enableDrawBuffers Boolean false inherited

是否开启 drawBuffers

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>

inherited getShadowMaterial(shadowMaterial){Material}

获取阴影材质,子类可重写

Name Type Description
shadowMaterial Material

通用阴影材质

Returns:
Type Description
Material