FreeWRL / FreeX3D 4.3.0
SFColor.java
1//AUTOMATICALLY GENERATED BY genfields.pl.
2//DO NOT EDIT!!!!
3
4package vrml.field;
5import vrml.*;
6import java.io.BufferedReader;
7import java.io.PrintWriter;
8import java.io.IOException;
9
10public class SFColor extends Field {
11 float red;
12 float green;
13 float blue;
14
15 public SFColor() { }
16
17 public SFColor(float red, float green, float blue) {
18 this.red = red;
19 this.green = green;
20 this.blue = blue;
21 }
22
23 public void getValue(float[] values) {
24 __updateRead();
25 values[0] = red;
26 values[1] = green;
27 values[2] = blue;
28 }
29
30 public float getRed() {
31 __updateRead();
32 return red;
33 }
34
35 public float getGreen() {
36 __updateRead();
37 return green;
38 }
39
40 public float getBlue() {
41 __updateRead();
42 return blue;
43 }
44
45 public void setValue(float red, float green, float blue) {
46 this.red = red;
47 this.green = green;
48 this.blue = blue;
49 __updateWrite();
50 }
51
52
53 public void setValue(float[] values) {
54 this.red = values[0];
55 this.green = values[1];
56 this.blue = values[2];
57 __updateWrite();
58 }
59
60 public void setValue(ConstSFColor sfColor) {
61 sfColor.__updateRead();
62 red = sfColor.red;
63 green = sfColor.green;
64 blue = sfColor.blue;
65 __updateWrite();
66 }
67
68 public void setValue(SFColor sfColor) {
69 sfColor.__updateRead();
70 red = sfColor.red;
71 green = sfColor.green;
72 blue = sfColor.blue;
73 __updateWrite();
74 }
75
76
77 public String toString() {
78 __updateRead();
79 return ""+red+" "+green+" "+blue;
80 }
81
82 public void __fromPerl(BufferedReader in) throws IOException {
83
84 //System.out.println ("fromPerl, Color");
85 red = Float.parseFloat(in.readLine());
86 green = Float.parseFloat(in.readLine());
87 blue = Float.parseFloat(in.readLine());
88 }
89
90 public void __toPerl(PrintWriter out) throws IOException {
91 out.print(red+ " "+green+" "+blue);
92 //out.println();
93 }
94 //public void setOffset(String offs) { this.offset = offs; } //JAS2
95 //public String getOffset() { return this.offset; } //JAS2
96}