Вы находитесь на странице: 1из 7

Java Mobile 3D Graphics (M3G aka JSR184).

17sep2005 / copperfeet
: 2005 M3G v1.1, .
1.0, .
Object3D. .
M3G (, , , , )
Object3D.
Object3D ( . set get):
- ID ( );
(
find()). ID .
ID find()
( ).
- ( );
null.
: Loader.load()
hash- (int , byte[]
).
- (AnimationTrack) , 0 .
, ( ) ( )
AnimationTrack. (
) animate(int ). -
, . :
, .
Objsect3D duplicate() getReferences()
(
).
.
, ,
Transformable ( , Object3D).
Transformable :
- scale(float sx,sy,sz);
- setScale(float sx,sy,sz);
- translate(float tx,ty,tz);
- setTranslate(float tx,ty,tz);
- setTransform(Transform tr); ( 4x4 )
- preRotate(float angle,ax,ay,az); ( angle ,
)
- postRotate(float angle,ax,ay,az); ( ,
).
- setOrientation(float angle,ax,ay,az); ( 3x3 4x4)
get .
M3G ( Vector2D, Vector3D, Point)
( Sphere,

Box, OOBB, ). , 4x4 (Transform).


:
0
4
8
12

1
5
9
13

2
6
10
14

3
7
11
15

(: X,Y,Z 3,7,11)
Transform ( ) :
- postMultiply(Transform transform) ( )
- postRotate(float angle,ax,ay,az) ( )
- postRotateQuat(float qx,qy,qz,qw) ( )
- postScale(float sx,sy,sz) ( )
- postTranslate(float tx,ty,tz) ( )
- transform(float[] vectors) ( , 16- -
)
- transform(VertexArray in, float[] out, boolean W) ( VertexArray
, out)
:
- invert()
- transpose()
( ):
- set(float[] matrix) (16 44 )
- set(Transform transform)
- setIdentity() ( )
get :
- get(float[] matrix)
.
RayIntersection.
.
, S T ,
submesh.
( ) pick() Group.
.
Node ( Transformable). Node :
Camera, Light, Sprite3D, Mesh Group ( Nodes) Node.
Node :
- setAlignment() align(Node n) ( Node
() Node(s). , , "billboards". :
,
.. );
- setAlphaFactor(float alphaFactor) ( [0..1],
.
Lights Cameras);
- setPickingEnable(boolean enable) (
, );
- setRenderingEnable(boolean enable) ( ,
) ;

- setScope(int scope) -
(scope). .
. Node , . Scope
,
.
get is . :
- getParent() null.
- getTransformTo(Node t, Transform tr) ,
.
Group.
Group ( Node) Node,
. : Node
.
, , World,
( exception).
, Group pick()
(scope).
World ( Group) .
Group :
-
- background.
.
Mesh SkinnedMesh MorphingMesh.
Mesh VertexBuffer, IndexBuffer sub-,
Appearance, sub- (Appearance - render state, .
).
SkinnedMesh ( Group
Node).
addTransform().
. ,
2- .
MorphingMesh (target) VertexBuffers
( , VertexBuffer)
.
.
VertexArray.
VertexArray 2, 3 4 . :
1 2 !
VertexArray bias scale (float) .
. . real_val = bias + val*scale.
:
VertexBuffer default_color VertexArray :

- (3 ) ( )
- (3 ) ( , )
- (3/4 RGB/ARGB) ( , default color)
- 1 (2 ) ( , .. )

- N (N , 1)
, Mesh,
IndexBuffer.
IndexBuffer 1.1.
IndexBuffer M3G:
TriangleStripArray. (, ) ,
IndexBuffer.
.
Appearance ( render_state environment
).
Appearance :
- Fog ( );
- PolygonMode ( (FLAT SMOTH), cull-mode (
), (CW CCW)).
- Material ( (ARGB) AMBIENT, DIFFUSE, EMISSIVE ( selfillum)
SPECULAR. shinnes (0..128), /
vertex_color, VertexBuffer).
- ComposingMode:
- / ( );
- / - ( );
- ALPHA ( ), ALPHA_ADD (),
MODULATE (), MODULATE_X2 (
), REPLACE ( ).
- / .
- Texture2D (1 , ):
-.
Texture2D:
- Image2D;
- (linear, nearest, base_level;
);
- wrapping S T (CLAMP REPEAT).
- (FUNC_ADD, FUNC_BLEND, FUNC_DECAL,
FUNC_MODULATE, FUNC_REPLACE) -color.
Image2D:
:
- MIDP AWT Image.
- NxM;
- NxM, ARGB
( set());

- NxM, ;
:
- RGB
- Alpha+RGB
- Luminance
- Alpha+Luminance
- Alpha only
Image2D ,
Graphics3D.bindTraget().
Background ( ). :
- Image2D, (REPEAT, BORDER),
crop- image;
- / (
);
Sprite3D:
Image2D Appearance ( ,
Node, , Transformable). crop-,
Image2D.
billboard particle system.
.
Camera :
- ( setPerspective() FOV, ,
/ ),
- - ( setParallel() FOV
( ), , /
).
- generic ( ).
.
Light :
- AMBIENT ( )
- DIRECTIONAL ( )
- OMNI ()
- SPOT ()
( . get):
setAttenuation(float constant, float linear, float quadratic)
setColor(int RGB)
setIntensity(float intensity)
setSpotAngle(float angle)
setSpotExponent(float exponent)
8- .
.
M3G Graphics3D.

(bindTarget()) Graphics MIDP


Image2D. (releaseTarget()).
Graphics3D :
- // Light ( );
- ( , World, );
- , (bindTarget()). Graphics Image2D
().
- ( clear())
- / .
- (getProperties(),
, , ..)
- viewport - image,
.
- , , ( 4- render()):
- World
- Node
- VertexBuffer ( scope
)
: get 1.1.

.
3D Max7 ( *.m3g ).
Loader.
Loader load ( , ).
Object3D ( m3g ),
Image2D , *.png .
( ).
.
:
AnimationTrack Object3D. AnimationController
KeyframeSequence :
ALPHA
AMBIENT_COLOR
COLOR
CROP
DENSITY
DIFFUSE_COLOR
EMISSIVE_COLOR
FAR_DISTANCE
FIELD_OF_VIEW
INTENSITY
MORPH_WEIGHTS
NEAR_DISTANCE
ORIENTATION

PICKABILITY
SCALE
SHININESS
SPECULAR_COLOR
SPOT_ANGLE
SPOT_EXPONENT
TRANSLATION
VISIBILITY
AnimationController
- .
- (1.0 , >1 , 0-, <0
)
- [T1,T2] ,
. T1==T2, .
- (
).
KeyframeSequence
-
- :
LINEAR
SLERP
SPLINE
SQUAD
STEP
- range .
- range:
CONSTANT
LOOP
M3G 1.1.
1.1 1.0 . ,
get :
AnimationController
Graphics3D
IndexBuffer
KeyframeSequence
Node
PolygonMode
SkinnedMesh
Texture2D
VertexArray
.
, .

Ketsujin Russian Studio
2005