我翻译的Material

Overview 

Package 

 Class 

Use 

Tree 

Deprecated 

Index 

Help 

Nov 19, 2003

 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES    

 

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

 

<hr size=2 width="100%" align=center>

javax.microedition.m 3g
Class Material


  
    
  
java.lang.Object
  |
  +--javax.microedition.m3g.Object3D
        |
        +--javax.microedition.m
    
     3g
    .Material

public class Material

extends Object3D

An Appearance component encapsulating material attributes for lighting computations. Other attributes required for lighting are defined in Light, PolygonMode and VertexBuffer.

一个包含着光照运算中材质属性的Appearance 分量。其他定义光照的属性被定义在Light, PolygonMode and VertexBuffer.

The diagram below illustrates how the final, lit color is obtained for a vertex. Lighting is disabled for a submesh if it has a null Material, and enabled otherwise. If lighting is disabled, the final vertex color is taken from the associated VertexBuffer as such. If lighting is enabled, the final color is computed according to the OpenGL 1.3 lighting equation (p. 48), using the material colors specified here. Finally, if vertex color tracking is enabled, the AMBIENT and DIFFUSE material colors are replaced with the per-vertex colors or the default color obtained from the VertexBuffer.

下图说明了最终的被灯光照射了的颜色是如何保存在顶点里面的。对一个submesh来说,如果它有一个空的材质,光照会被禁用,反之则启用。如果光照被禁用,最终的顶点颜色会从关联的VertexBuffer里面取得。如果光照启用,最终的颜色会根据这里材质所指定的颜色,通过OpenGL1.3的公式进行计算。最后,如果顶点颜色跟踪被启用,材质里面的AMBIENTDIFFUSE颜色会被每个顶点的颜色或者从VertexBuffer里面获得的默认颜色。

Implementation guidelines

Lighting is computed according to the OpenGL 1.3 specification, section 2.13.1 , with the following exceptions:

  • the secondary color is not supported;
  • 合成色不被支持
  • the same Material is used for both the front face and the back face;
  • 正面和背面使用同样的材质
  • vertex color tracking is limited to AMBIENT_AND_DIFFUSE;
  • 顶点颜色追踪只适用于AMBIENT_AND_DIFFUSE
  • for an ambient Light, the diffuse and specular intensities are zero;
  • 对于一个环境光源,散射光和镜面光强度都为0
  • for a directional or positional Light, the ambient intensity is zero;
  • 对于一个方向光或者定点光源,环境光强为0
  • the diffuse and specular Light intensities can not be set separately;
  • 散射光和镜面光强不可以被分开设定
  • the global scene ambient color acs is not supported;
  • 全局环境光acs不被支持

See Also:

Binary format


Field Summary

static int

AMBIENT

环境光
          A parameter to
setColor and getColor, specifying that the ambient color component is to be set or retrieved.

static int

DIFFUSE

散射光
          A parameter to
setColor and getColor, specifying that the diffuse color component is to be set or retrieved.

static int

EMISSIVE

发射光
          A parameter to
setColor and getColor, specifying that the emissive color component is to be set or retrieved.

static int

SPECULAR

镜面发射光
          A parameter to
setColor and getColor, specifying that the specular color component is to be set or retrieved.

 

Constructor Summary

Material()
          Creates a Material object with default values.

 

 

Method Summary

 int

getColor(int target)
          Gets the value of the specified color component of this Material.

获得该材质指定的颜色分量

 float

getShininess()
          Gets the current shininess of this Material.

获得该材质当前辉度

 boolean

isVertexColorTrackingEnabled()
          Queries whether vertex color tracking is enabled.

查询顶点颜色追踪是否启用

 void

setColor(int target, int ARGB)
          Sets the given value to the specified color component(s) of this Material.

为该材质的指定颜色分量设置颜色值

 void

setShininess(float shininess)
          Sets the shininess of this Material.

设置该材质得辉度

 void

setVertexColorTrackingEnable(boolean enable)
          Enables or disables vertex color tracking.

启用或者禁用光照追踪

 

Methods inherited from class javax.microedition.m 3g .Object3D

addAnimationTrack, animate, duplicate, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, getUserObject, removeAnimationTrack, setUserID, setUserObject

 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

AMBIENT


  
    
  
public static final int AMBIENT

A parameter to setColor and getColor, specifying that the ambient color component is to be set or retrieved.

环境光

环境光是没有方向性的、在空间中均匀分布的光。环境光从各个方向各个方向落向物体的表面通道。这种光从物体的反射是和物体表面位置独立的,并且在所有方向上的光密度相等。

See Also:

Constant Field Values


DIFFUSE


  
    
  
public static final int DIFFUSE

A parameter to setColor and getColor, specifying that the diffuse color component is to be set or retrieved.

散射

散射光和反射表明了光源的方向。照射在表面上的光的强度随物体方向和光源方向之间的角度的不同而不同。散射材质将光均匀地散射在各个方向上。

See Also:

Constant Field Values


EMISSIVE


  
    
  
public static final int EMISSIVE

A parameter to setColor and getColor, specifying that the emissive color component is to be set or retrieved.

发射光

自发光或者自放射的物体的颜色。发光材质的强度不属于任何外部的光源。

See Also:

Constant Field Values


SPECULAR


  
    
  
public static final int SPECULAR

A parameter to setColor and getColor, specifying that the specular color component is to be set or retrieved.

镜面反射光

镜面光和反射式来自发光物体的反射和观察者的位置的合并。当观察者何发射光的角度为0时,镜面的反射程度最大。镜面材质在反射的方向上以最大的强度反射光,并且它的亮度是衰减的,衰减程度是以指数值shininess为基础的。

See Also:

Constant Field Values

Constructor Detail

Material


  
    
  
public Material()

Creates a Material object with default values. The default values are:

·   vertex color tracking : false (disabled)

·   ambient color : 0x00333333 (0.2, 0.2, 0.2, 0.0)

·   diffuse color : 0xFFCCCCCC (0.8, 0.8, 0.8, 1.0)

·   emissive color : 0x00000000 (0.0, 0.0, 0.0, 0.0)

·   specular color : 0x00000000 (0.0, 0.0, 0.0, 0.0)

·   shininess : 0.0

Note that even though the alpha component can be set for all color components, it is ignored for all but the diffuse component.

注意虽然可以给所有颜色分量设置alpha分量,但是它除了散射光分量外都会被忽略。

Method Detail

setColor


  
    
  
public void setColor(int target,
                     int ARGB)

Sets the given value to the specified color component(s) of this Material. The color components to set are specified as an inclusive OR of one or more of the symbolic constants listed above. The color is given in ARGB format, but the alpha component is ignored for all but the diffuse color.

alpha通道会被除了散射光之外的其余光自动忽略。

Parameters:

target - a bitmask of color component identifiers

ARGB - color for the target property (or properties) in 0xAARRGGBB format

Throws:

java.lang.IllegalArgumentException - if target has a value other than an inclusive OR of one or more of AMBIENT, DIFFUSE, EMISSIVE, SPECULAR

See Also:

getColor


getColor


  
    
  
public int getColor(int target)

Gets the value of the specified color component of this Material. The alpha component of the returned value is guaranteed to be zero for all but the diffuse color component.

获得该材质指定的颜色分量。除了散射光颜色分量外,其余的返回值得alpha分量都会被置为0

Parameters:

target - exactly one of AMBIENT, DIFFUSE, EMISSIVE, SPECULAR

Returns:

the current color of the target property in 0xAARRGGBB format

Throws:

java.lang.IllegalArgumentException - if target has a value other than one of those listed above

See Also:

setColor


setShininess


  
    
  
public void setShininess(float shininess)

Sets the shininess of this Material. Shininess is the specular exponent term in the lighting equation, and it can take on values between [0, 128]. Large values of shininess make the specular highlights more concentrated, and small values make them more spread out.

设定这个材质的辉度。辉度是光照方程式中的镜面指数(specular exponent),它的值在[0, 128]之间,它控制这镜面光照衰减的程度。辉度越大,镜面反射光高亮区域越集中,辉度越小高亮区域越发散。

Parameters:

shininess - the specular exponent value to set for this Material 这个材质的辉度

Throws:

java.lang.IllegalArgumentException - if shininess is not in [0, 128]

See Also:

getShininess


getShininess


  
    
  
public float getShininess()

Gets the current shininess of this Material.

获得当前材质的辉度。

Returns:

the current specular exponent value of this Material

See Also:

setShininess


setVertexColorTrackingEnable


  
    
  
public void setVertexColorTrackingEnable(boolean enable)

Enables or disables vertex color tracking. When enabled, the AMBIENT and DIFFUSE material colors will take on color values from the associated VertexBuffer on a per-vertex basis. The ambient and diffuse color values of this Material are ignored in that case.

启用或禁用顶点颜色跟踪。如果启用,那么环境光和散射光的材质颜色就会以每一个VertexBuffer的相关联的颜色值为主。而那样的话这个Material的环境和散射颜色值就会被忽略掉。

Parameters:

enable - true to turn vertex color tracking on; false to turn it off


isVertexColorTrackingEnabled


  
    
  
public boolean isVertexColorTrackingEnabled()

Queries whether vertex color tracking is enabled.

查询顶点颜色追踪是否启用。

Returns:

true if vertex color tracking is enabled; false if it's disabled

<hr size=2 width="100%" align=center>

Overview 

Package 

 Class 

Use 

Tree 

Deprecated 

Index 

Help 

Nov 19, 2003

 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES    

 

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

 

<hr size=2 width="100%" align=center>

Copyright © 2003 Nokia Corporation. See the Copyright Notice for details.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值