blob: 115ae0341a11c01e7f7efdc1db1f127a2df91f50 [file] [log] [blame]
Jason Sams0835d422009-08-04 17:58:23 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.renderscript;
18
Jason Sams0835d422009-08-04 17:58:23 -070019import android.util.Config;
20import android.util.Log;
21
Jason Sams0835d422009-08-04 17:58:23 -070022/**
23 * @hide
24 *
25 **/
26public class Light extends BaseObj {
27 Light(int id, RenderScript rs) {
28 super(rs);
29 mID = id;
30 }
31
Jason Sams0835d422009-08-04 17:58:23 -070032 public void setColor(float r, float g, float b) {
33 mRS.nLightSetColor(mID, r, g, b);
34 }
35
36 public void setPosition(float x, float y, float z) {
37 mRS.nLightSetPosition(mID, x, y, z);
38 }
39
40 public static class Builder {
41 RenderScript mRS;
42 boolean mIsMono;
43 boolean mIsLocal;
44
45 public Builder(RenderScript rs) {
46 mRS = rs;
47 mIsMono = false;
48 mIsLocal = false;
49 }
50
51 public void lightSetIsMono(boolean isMono) {
52 mIsMono = isMono;
53 }
54
55 public void lightSetIsLocal(boolean isLocal) {
56 mIsLocal = isLocal;
57 }
58
59 static synchronized Light internalCreate(RenderScript rs, Builder b) {
60 rs.nSamplerBegin();
61 rs.nLightSetIsMono(b.mIsMono);
62 rs.nLightSetIsLocal(b.mIsLocal);
63 int id = rs.nLightCreate();
64 return new Light(id, rs);
65 }
66
67 public Light create() {
68 return internalCreate(mRS, this);
69 }
70 }
71
72}
73