|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package javax.microedition.m3g; |
|
20 |
|
21 public class Camera extends Node |
|
22 { |
|
23 //------------------------------------------------------------------ |
|
24 // Static data |
|
25 //------------------------------------------------------------------ |
|
26 |
|
27 public static final int GENERIC = 48; |
|
28 public static final int PARALLEL = 49; |
|
29 public static final int PERSPECTIVE = 50; |
|
30 |
|
31 //------------------------------------------------------------------ |
|
32 // Constructors |
|
33 //------------------------------------------------------------------ |
|
34 |
|
35 public Camera() |
|
36 { |
|
37 super(_ctor(Interface.getHandle())); |
|
38 } |
|
39 |
|
40 /** |
|
41 */ |
|
42 Camera(int handle) |
|
43 { |
|
44 super(handle); |
|
45 } |
|
46 |
|
47 //------------------------------------------------------------------ |
|
48 // Public methods |
|
49 //------------------------------------------------------------------ |
|
50 |
|
51 public void setParallel(float height, float aspectRatio, float near, float far) |
|
52 { |
|
53 _setParallel(handle, height, aspectRatio, near, far); |
|
54 } |
|
55 |
|
56 public void setPerspective(float fovy, float aspectRatio, float near, float far) |
|
57 { |
|
58 _setPerspective(handle, fovy, aspectRatio, near, far); |
|
59 } |
|
60 |
|
61 public void setGeneric(Transform transform) |
|
62 { |
|
63 _setGeneric(handle, transform.matrix); |
|
64 } |
|
65 |
|
66 public int getProjection(Transform transform) |
|
67 { |
|
68 return _getProjectionAsTransform(handle, transform != null ? transform.matrix : null); |
|
69 } |
|
70 |
|
71 public int getProjection(float[] params) |
|
72 { |
|
73 return _getProjectionAsParams(handle, params); |
|
74 } |
|
75 |
|
76 //------------------------------------------------------------------ |
|
77 // Private methods |
|
78 //------------------------------------------------------------------ |
|
79 |
|
80 // Native methods |
|
81 private static native int _ctor(int hInterface); |
|
82 private static native void _setParallel(int handle, float height, float aspectRatio, float near, float far); |
|
83 private static native void _setPerspective(int handle, float fovy, float aspectRatio, float near, float far); |
|
84 private static native void _setGeneric(int handle, byte[] transform); |
|
85 private static native int _getProjectionAsTransform(int handle, byte[] transform); |
|
86 private static native int _getProjectionAsParams(int handle, float[] params); |
|
87 } |