|
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 Light extends Node |
|
22 { |
|
23 public static final int AMBIENT = 128; |
|
24 public static final int DIRECTIONAL = 129; |
|
25 public static final int OMNI = 130; |
|
26 public static final int SPOT = 131; |
|
27 |
|
28 public Light() |
|
29 { |
|
30 super(_ctor(Interface.getHandle())); |
|
31 } |
|
32 |
|
33 /** |
|
34 */ |
|
35 Light(int handle) |
|
36 { |
|
37 super(handle); |
|
38 } |
|
39 |
|
40 public void setIntensity(float intensity) |
|
41 { |
|
42 _setIntensity(handle, intensity); |
|
43 } |
|
44 |
|
45 public float getIntensity() |
|
46 { |
|
47 return _getIntensity(handle); |
|
48 } |
|
49 |
|
50 public void setColor(int RGB) |
|
51 { |
|
52 _setColor(handle, RGB); |
|
53 } |
|
54 |
|
55 public int getColor() |
|
56 { |
|
57 return _getColor(handle); |
|
58 } |
|
59 |
|
60 public void setMode(int mode) |
|
61 { |
|
62 _setMode(handle, mode); |
|
63 } |
|
64 |
|
65 public int getMode() |
|
66 { |
|
67 return _getMode(handle); |
|
68 } |
|
69 |
|
70 public void setSpotAngle(float angle) |
|
71 { |
|
72 _setSpotAngle(handle, angle); |
|
73 } |
|
74 |
|
75 public float getSpotAngle() |
|
76 { |
|
77 return _getSpotAngle(handle); |
|
78 } |
|
79 |
|
80 public void setSpotExponent(float exponent) |
|
81 { |
|
82 _setSpotExponent(handle, exponent); |
|
83 } |
|
84 |
|
85 public float getSpotExponent() |
|
86 { |
|
87 return _getSpotExponent(handle); |
|
88 } |
|
89 |
|
90 public void setAttenuation(float constant, float linear, float quadratic) |
|
91 { |
|
92 _setAttenuation(handle, constant, linear, quadratic); |
|
93 } |
|
94 |
|
95 public float getConstantAttenuation() |
|
96 { |
|
97 return _getAttenuation(handle, Defs.GET_CONSTANT); |
|
98 } |
|
99 |
|
100 public float getLinearAttenuation() |
|
101 { |
|
102 return _getAttenuation(handle, Defs.GET_LINEAR); |
|
103 } |
|
104 |
|
105 public float getQuadraticAttenuation() |
|
106 { |
|
107 return _getAttenuation(handle, Defs.GET_QUADRATIC); |
|
108 } |
|
109 |
|
110 // Native methods |
|
111 private static native int _ctor(int hInterface); |
|
112 private static native void _setIntensity(int handle, float intensity); |
|
113 private static native float _getIntensity(int handle); |
|
114 private static native void _setColor(int handle, int RGB); |
|
115 private static native int _getColor(int handle); |
|
116 private static native void _setMode(int handle, int mode); |
|
117 private static native int _getMode(int handle); |
|
118 private static native void _setSpotAngle(int handle, float angle); |
|
119 private static native float _getSpotAngle(int handle); |
|
120 private static native void _setSpotExponent(int handle, float exponent); |
|
121 private static native float _getSpotExponent(int handle); |
|
122 private static native void _setAttenuation(int handle, float constant, float linear, float quadratic); |
|
123 private static native float _getAttenuation(int handle, int type); |
|
124 } |