-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtexture_cube_map.go
208 lines (188 loc) · 5.02 KB
/
texture_cube_map.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package osg
import (
"github.com/flywave/go-osg/model"
)
func checkPosX(tex interface{}) bool {
return true
}
func readPosX(is *OsgIstream, tex interface{}) {
var hasImage bool
is.Read(&hasImage)
if hasImage {
is.Read(is.BEGINBRACKET)
image := is.ReadImage(true)
tex.(*model.TextureCubeMap).SetImage(model.POSITIVEX, image)
is.Read(is.ENDBRACKET)
}
}
func writePosX(os *OsgOstream, tex interface{}) {
image := tex.(*model.TextureCubeMap).GetImage(model.POSITIVEX)
os.Write(image != nil)
if image != nil {
os.Write(os.BEGINBRACKET)
os.WriteImage(image)
os.Write(os.ENDBRACKET)
os.Write(os.CRLF)
}
os.Write(os.CRLF)
}
func checkNegX(tex interface{}) bool {
return true
}
func readNegX(is *OsgIstream, tex interface{}) {
var hasImage bool
is.Read(&hasImage)
if hasImage {
is.Read(is.BEGINBRACKET)
image := is.ReadImage(true)
tex.(*model.TextureCubeMap).SetImage(model.NEGATIVEX, image)
is.Read(is.ENDBRACKET)
}
}
func writeNegX(os *OsgOstream, tex interface{}) {
image := tex.(*model.TextureCubeMap).GetImage(model.NEGATIVEX)
os.Write(image != nil)
if image != nil {
os.Write(os.BEGINBRACKET)
os.Write(image)
os.Write(os.ENDBRACKET)
os.Write(os.CRLF)
}
os.Write(os.CRLF)
}
func checkPosY(tex interface{}) bool {
return true
}
func readPosY(is *OsgIstream, tex interface{}) {
var hasImage bool
is.Read(&hasImage)
if hasImage {
is.Read(is.BEGINBRACKET)
image := is.ReadImage(true)
tex.(*model.TextureCubeMap).SetImage(model.POSITIVEY, image)
is.Read(is.ENDBRACKET)
}
}
func writePosY(os *OsgOstream, tex interface{}) {
image := tex.(*model.TextureCubeMap).GetImage(model.POSITIVEY)
os.Write(image != nil)
if image != nil {
os.Write(os.BEGINBRACKET)
os.Write(image)
os.Write(os.ENDBRACKET)
os.Write(os.CRLF)
}
os.Write(os.CRLF)
}
func checkNegY(tex interface{}) bool {
return true
}
func readNegY(is *OsgIstream, tex interface{}) {
var hasImage bool
is.Read(&hasImage)
if hasImage {
is.Read(is.BEGINBRACKET)
image := is.ReadImage(true)
tex.(*model.TextureCubeMap).SetImage(model.NEGATIVEY, image)
is.Read(is.ENDBRACKET)
}
}
func writeNegY(os *OsgOstream, tex interface{}) {
image := tex.(*model.TextureCubeMap).GetImage(model.NEGATIVEY)
os.Write(image != nil)
if image != nil {
os.Write(os.BEGINBRACKET)
os.Write(image)
os.Write(os.ENDBRACKET)
os.Write(os.CRLF)
}
os.Write(os.CRLF)
}
func checkPosZ(tex interface{}) bool {
return true
}
func readPosZ(is *OsgIstream, tex interface{}) {
var hasImage bool
is.Read(&hasImage)
if hasImage {
is.Read(is.BEGINBRACKET)
image := is.ReadImage(true)
tex.(*model.TextureCubeMap).SetImage(model.POSITIVEZ, image)
is.Read(is.ENDBRACKET)
}
}
func writePosZ(os *OsgOstream, tex interface{}) {
image := tex.(*model.TextureCubeMap).GetImage(model.POSITIVEZ)
os.Write(image != nil)
if image != nil {
os.Write(os.BEGINBRACKET)
os.Write(image)
os.Write(os.ENDBRACKET)
os.Write(os.CRLF)
}
os.Write(os.CRLF)
}
func checkNegZ(tex interface{}) bool {
return true
}
func readNegZ(is *OsgIstream, tex interface{}) {
var hasImage bool
is.Read(&hasImage)
if hasImage {
is.Read(is.BEGINBRACKET)
image := is.ReadImage(true)
tex.(*model.TextureCubeMap).SetImage(model.NEGATIVEZ, image)
is.Read(is.ENDBRACKET)
}
}
func writeNegZ(os *OsgOstream, tex interface{}) {
image := tex.(*model.TextureCubeMap).GetImage(model.NEGATIVEZ)
os.Write(image != nil)
if image != nil {
os.Write(os.BEGINBRACKET)
os.Write(image)
os.Write(os.ENDBRACKET)
os.Write(os.CRLF)
}
os.Write(os.CRLF)
}
func getTextureWidth(obj interface{}) interface{} {
t := obj.(*model.TextureCubeMap)
return &t.TextureWidth
}
func setTextureWidth(obj interface{}, val interface{}) {
t := obj.(*model.TextureCubeMap)
t.TextureWidth = val.(uint32)
}
func getTextureHeight(obj interface{}) interface{} {
t := obj.(*model.TextureCubeMap)
return &t.TextureHeight
}
func setTextureHeight(obj interface{}, val interface{}) {
t := obj.(*model.TextureCubeMap)
t.TextureHeight = val.(uint32)
}
func init() {
fn := func() interface{} {
tg := model.NewTextureCubeMap()
return tg
}
wrap := NewObjectWrapper("TextureCubeMap", fn, "osg::Object osg::StateAttribute osg::Texture osg::TextureCubeMap")
ser1 := NewUserSerializer("PosX", checkPosX, readPosX, writePosX)
ser2 := NewUserSerializer("NegX", checkNegX, readNegX, writeNegX)
ser3 := NewUserSerializer("PosY", checkPosY, readPosY, writePosY)
ser4 := NewUserSerializer("NegY", checkNegY, readNegY, writeNegY)
ser5 := NewUserSerializer("PosZ", checkPosZ, readPosZ, writePosZ)
ser6 := NewUserSerializer("NegZ", checkNegZ, readNegZ, writeNegZ)
ser7 := NewPropByValSerializer("TextureWidth", false, getTextureWidth, setTextureWidth)
ser8 := NewPropByValSerializer("TextureHeight", false, getTextureHeight, setTextureHeight)
wrap.AddSerializer(ser1, RWUSER)
wrap.AddSerializer(ser2, RWUSER)
wrap.AddSerializer(ser3, RWUSER)
wrap.AddSerializer(ser4, RWUSER)
wrap.AddSerializer(ser5, RWUSER)
wrap.AddSerializer(ser6, RWUSER)
wrap.AddSerializer(ser7, RWINT)
wrap.AddSerializer(ser8, RWINT)
GetObjectWrapperManager().AddWrap(wrap)
}