1 /*
2 * Copyright (C) 2012 Alberto Irurueta Carro (alberto@irurueta.com)
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 package com.irurueta.geometry.io;
17
18 /**
19 * Enumerator containing the available illumination options and their
20 * corresponding integer values, as shown below:
21 * 0. Color on and Ambient off.
22 * 1. Color on and Ambient on.
23 * 2. Highlight on.
24 * 3. Reflection on and Ray trace on.
25 * 4. Transparency: Glass on, Reflection: Ray trace on.
26 * 5. Reflection: Fresnel on and Ray trace on.
27 * 6. Transparency: Refraction on, Reflection: Fresnel off and Ray trace on.
28 * 7. Transparency: Refraction on, Reflection: Fresnel on and Ray trace on.
29 * 8. Reflection on and Ray trace off.
30 * 9. Transparency: Glass on, Reflection: Ray trace off.
31 * 10. Casts shadows onto invisible surfaces.
32 */
33 public enum Illumination {
34 /**
35 * Color on and ambient off.
36 */
37 COLOR_AND_AMBIENT_OFF(0),
38
39 /**
40 * Color on and ambient on.
41 */
42 COLOR_AND_AMBIENT_ON(1),
43
44 /**
45 * Highlight on.
46 */
47 HIGHLIGHT_ON(2),
48
49 /**
50 * Reflection on and ray trace on.
51 */
52 REFLECTION_ON_AND_RAY_TRACE_ON(3),
53
54 /**
55 * Transparency: glass on, reflection: ray trace on.
56 */
57 TRANSPARENCY_GLASS_ON_REFLECTION_RAYTRACE_ON(4),
58
59 /**
60 * Reflection: Fresnel on and ray trace on.
61 */
62 REFLECTION_FRESNEL_ON_AND_RAY_TRACE_ON(5),
63
64 /**
65 * Transparency: refraction on, Reflection: Fresnel off and ray trace on.
66 */
67 TRANSPARENCY_REFRACTION_ON_REFLECTION_FRESNEL_OFF_AND_RAY_TRACE_ON(6),
68
69 /**
70 * Transparency: refraction on, Reflection: Fresnel on and ray trace on.
71 */
72 TRANSPARENCY_REFRACTION_ON_REFLECTION_FRESNEL_ON_AND_RAY_TRACE_ON(7),
73
74 /**
75 * Reflection on and ray trace off.
76 */
77 REFLECTION_ON_AND_RAY_TRACE_OFF(8),
78
79 /**
80 * Transparency: glass on, Reflection: ray trace off.
81 */
82 TRANSPARENCY_GLASS_ON_REFLECTION_RAY_TRACE_OFF(9),
83
84 /**
85 * Cast shadows onto invisible surfaces.
86 */
87 CAST_SHADOWS_ONTO_INVISIBLE_SURFACES(10);
88
89 /**
90 * Internal value to be stored as part of this enum.
91 */
92 private final int value;
93
94 /**
95 * Constructor.
96 *
97 * @param value value associated to this enum.
98 */
99 Illumination(final int value) {
100 this.value = value;
101 }
102
103 /**
104 * Returns value associated to this enum.
105 *
106 * @return value associated to this enum.
107 */
108 public int value() {
109 return value;
110 }
111
112 /**
113 * Factory method to create and instance of this enum from its associated
114 * value.
115 *
116 * @param value value associated to enum to be created.
117 * @return an illumination instance.
118 */
119 public static Illumination forValue(final int value) {
120 if (value >= 0 && value <= 10) {
121 return Illumination.values()[value];
122 } else {
123 return null;
124 }
125 }
126 }