This page hosts a formal specification of RenderWare binary stream using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
// Code generated by kaitai-struct-compiler from a .ksy source file. DO NOT EDIT.
import (
"github.com/kaitai-io/kaitai_struct_go_runtime/kaitai"
"bytes"
)
/**
* @see <a href="https://gtamods.com/wiki/RenderWare_binary_stream_file">Source</a>
*/
type RenderwareBinaryStream_Sections int
const (
RenderwareBinaryStream_Sections__Struct RenderwareBinaryStream_Sections = 1
RenderwareBinaryStream_Sections__String RenderwareBinaryStream_Sections = 2
RenderwareBinaryStream_Sections__Extension RenderwareBinaryStream_Sections = 3
RenderwareBinaryStream_Sections__Camera RenderwareBinaryStream_Sections = 5
RenderwareBinaryStream_Sections__Texture RenderwareBinaryStream_Sections = 6
RenderwareBinaryStream_Sections__Material RenderwareBinaryStream_Sections = 7
RenderwareBinaryStream_Sections__MaterialList RenderwareBinaryStream_Sections = 8
RenderwareBinaryStream_Sections__AtomicSection RenderwareBinaryStream_Sections = 9
RenderwareBinaryStream_Sections__PlaneSection RenderwareBinaryStream_Sections = 10
RenderwareBinaryStream_Sections__World RenderwareBinaryStream_Sections = 11
RenderwareBinaryStream_Sections__Spline RenderwareBinaryStream_Sections = 12
RenderwareBinaryStream_Sections__Matrix RenderwareBinaryStream_Sections = 13
RenderwareBinaryStream_Sections__FrameList RenderwareBinaryStream_Sections = 14
RenderwareBinaryStream_Sections__Geometry RenderwareBinaryStream_Sections = 15
RenderwareBinaryStream_Sections__Clump RenderwareBinaryStream_Sections = 16
RenderwareBinaryStream_Sections__Light RenderwareBinaryStream_Sections = 18
RenderwareBinaryStream_Sections__UnicodeString RenderwareBinaryStream_Sections = 19
RenderwareBinaryStream_Sections__Atomic RenderwareBinaryStream_Sections = 20
RenderwareBinaryStream_Sections__TextureNative RenderwareBinaryStream_Sections = 21
RenderwareBinaryStream_Sections__TextureDictionary RenderwareBinaryStream_Sections = 22
RenderwareBinaryStream_Sections__AnimationDatabase RenderwareBinaryStream_Sections = 23
RenderwareBinaryStream_Sections__Image RenderwareBinaryStream_Sections = 24
RenderwareBinaryStream_Sections__SkinAnimation RenderwareBinaryStream_Sections = 25
RenderwareBinaryStream_Sections__GeometryList RenderwareBinaryStream_Sections = 26
RenderwareBinaryStream_Sections__AnimAnimation RenderwareBinaryStream_Sections = 27
RenderwareBinaryStream_Sections__Team RenderwareBinaryStream_Sections = 28
RenderwareBinaryStream_Sections__Crowd RenderwareBinaryStream_Sections = 29
RenderwareBinaryStream_Sections__DeltaMorphAnimation RenderwareBinaryStream_Sections = 30
RenderwareBinaryStream_Sections__RightToRender RenderwareBinaryStream_Sections = 31
RenderwareBinaryStream_Sections__MultitextureEffectNative RenderwareBinaryStream_Sections = 32
RenderwareBinaryStream_Sections__MultitextureEffectDictionary RenderwareBinaryStream_Sections = 33
RenderwareBinaryStream_Sections__TeamDictionary RenderwareBinaryStream_Sections = 34
RenderwareBinaryStream_Sections__PlatformIndependentTextureDictionary RenderwareBinaryStream_Sections = 35
RenderwareBinaryStream_Sections__TableOfContents RenderwareBinaryStream_Sections = 36
RenderwareBinaryStream_Sections__ParticleStandardGlobalData RenderwareBinaryStream_Sections = 37
RenderwareBinaryStream_Sections__Altpipe RenderwareBinaryStream_Sections = 38
RenderwareBinaryStream_Sections__PlatformIndependentPeds RenderwareBinaryStream_Sections = 39
RenderwareBinaryStream_Sections__PatchMesh RenderwareBinaryStream_Sections = 40
RenderwareBinaryStream_Sections__ChunkGroupStart RenderwareBinaryStream_Sections = 41
RenderwareBinaryStream_Sections__ChunkGroupEnd RenderwareBinaryStream_Sections = 42
RenderwareBinaryStream_Sections__UvAnimationDictionary RenderwareBinaryStream_Sections = 43
RenderwareBinaryStream_Sections__CollTree RenderwareBinaryStream_Sections = 44
RenderwareBinaryStream_Sections__MetricsPlg RenderwareBinaryStream_Sections = 257
RenderwareBinaryStream_Sections__SplinePlg RenderwareBinaryStream_Sections = 258
RenderwareBinaryStream_Sections__StereoPlg RenderwareBinaryStream_Sections = 259
RenderwareBinaryStream_Sections__VrmlPlg RenderwareBinaryStream_Sections = 260
RenderwareBinaryStream_Sections__MorphPlg RenderwareBinaryStream_Sections = 261
RenderwareBinaryStream_Sections__PvsPlg RenderwareBinaryStream_Sections = 262
RenderwareBinaryStream_Sections__MemoryLeakPlg RenderwareBinaryStream_Sections = 263
RenderwareBinaryStream_Sections__AnimationPlg RenderwareBinaryStream_Sections = 264
RenderwareBinaryStream_Sections__GlossPlg RenderwareBinaryStream_Sections = 265
RenderwareBinaryStream_Sections__LogoPlg RenderwareBinaryStream_Sections = 266
RenderwareBinaryStream_Sections__MemoryInfoPlg RenderwareBinaryStream_Sections = 267
RenderwareBinaryStream_Sections__RandomPlg RenderwareBinaryStream_Sections = 268
RenderwareBinaryStream_Sections__PngImagePlg RenderwareBinaryStream_Sections = 269
RenderwareBinaryStream_Sections__BonePlg RenderwareBinaryStream_Sections = 270
RenderwareBinaryStream_Sections__VrmlAnimPlg RenderwareBinaryStream_Sections = 271
RenderwareBinaryStream_Sections__SkyMipmapVal RenderwareBinaryStream_Sections = 272
RenderwareBinaryStream_Sections__MrmPlg RenderwareBinaryStream_Sections = 273
RenderwareBinaryStream_Sections__LodAtomicPlg RenderwareBinaryStream_Sections = 274
RenderwareBinaryStream_Sections__MePlg RenderwareBinaryStream_Sections = 275
RenderwareBinaryStream_Sections__LightmapPlg RenderwareBinaryStream_Sections = 276
RenderwareBinaryStream_Sections__RefinePlg RenderwareBinaryStream_Sections = 277
RenderwareBinaryStream_Sections__SkinPlg RenderwareBinaryStream_Sections = 278
RenderwareBinaryStream_Sections__LabelPlg RenderwareBinaryStream_Sections = 279
RenderwareBinaryStream_Sections__ParticlesPlg RenderwareBinaryStream_Sections = 280
RenderwareBinaryStream_Sections__GeomtxPlg RenderwareBinaryStream_Sections = 281
RenderwareBinaryStream_Sections__SynthCorePlg RenderwareBinaryStream_Sections = 282
RenderwareBinaryStream_Sections__StqppPlg RenderwareBinaryStream_Sections = 283
RenderwareBinaryStream_Sections__PartPpPlg RenderwareBinaryStream_Sections = 284
RenderwareBinaryStream_Sections__CollisionPlg RenderwareBinaryStream_Sections = 285
RenderwareBinaryStream_Sections__HanimPlg RenderwareBinaryStream_Sections = 286
RenderwareBinaryStream_Sections__UserDataPlg RenderwareBinaryStream_Sections = 287
RenderwareBinaryStream_Sections__MaterialEffectsPlg RenderwareBinaryStream_Sections = 288
RenderwareBinaryStream_Sections__ParticleSystemPlg RenderwareBinaryStream_Sections = 289
RenderwareBinaryStream_Sections__DeltaMorphPlg RenderwareBinaryStream_Sections = 290
RenderwareBinaryStream_Sections__PatchPlg RenderwareBinaryStream_Sections = 291
RenderwareBinaryStream_Sections__TeamPlg RenderwareBinaryStream_Sections = 292
RenderwareBinaryStream_Sections__CrowdPpPlg RenderwareBinaryStream_Sections = 293
RenderwareBinaryStream_Sections__MipSplitPlg RenderwareBinaryStream_Sections = 294
RenderwareBinaryStream_Sections__AnisotropyPlg RenderwareBinaryStream_Sections = 295
RenderwareBinaryStream_Sections__GcnMaterialPlg RenderwareBinaryStream_Sections = 297
RenderwareBinaryStream_Sections__GeometricPvsPlg RenderwareBinaryStream_Sections = 298
RenderwareBinaryStream_Sections__XboxMaterialPlg RenderwareBinaryStream_Sections = 299
RenderwareBinaryStream_Sections__MultiTexturePlg RenderwareBinaryStream_Sections = 300
RenderwareBinaryStream_Sections__ChainPlg RenderwareBinaryStream_Sections = 301
RenderwareBinaryStream_Sections__ToonPlg RenderwareBinaryStream_Sections = 302
RenderwareBinaryStream_Sections__PtankPlg RenderwareBinaryStream_Sections = 303
RenderwareBinaryStream_Sections__ParticleStandardPlg RenderwareBinaryStream_Sections = 304
RenderwareBinaryStream_Sections__PdsPlg RenderwareBinaryStream_Sections = 305
RenderwareBinaryStream_Sections__PrtadvPlg RenderwareBinaryStream_Sections = 306
RenderwareBinaryStream_Sections__NormalMapPlg RenderwareBinaryStream_Sections = 307
RenderwareBinaryStream_Sections__AdcPlg RenderwareBinaryStream_Sections = 308
RenderwareBinaryStream_Sections__UvAnimationPlg RenderwareBinaryStream_Sections = 309
RenderwareBinaryStream_Sections__CharacterSetPlg RenderwareBinaryStream_Sections = 384
RenderwareBinaryStream_Sections__NohsWorldPlg RenderwareBinaryStream_Sections = 385
RenderwareBinaryStream_Sections__ImportUtilPlg RenderwareBinaryStream_Sections = 386
RenderwareBinaryStream_Sections__SlerpPlg RenderwareBinaryStream_Sections = 387
RenderwareBinaryStream_Sections__OptimPlg RenderwareBinaryStream_Sections = 388
RenderwareBinaryStream_Sections__TlWorldPlg RenderwareBinaryStream_Sections = 389
RenderwareBinaryStream_Sections__DatabasePlg RenderwareBinaryStream_Sections = 390
RenderwareBinaryStream_Sections__RaytracePlg RenderwareBinaryStream_Sections = 391
RenderwareBinaryStream_Sections__RayPlg RenderwareBinaryStream_Sections = 392
RenderwareBinaryStream_Sections__LibraryPlg RenderwareBinaryStream_Sections = 393
RenderwareBinaryStream_Sections__Plg2d RenderwareBinaryStream_Sections = 400
RenderwareBinaryStream_Sections__TileRenderPlg RenderwareBinaryStream_Sections = 401
RenderwareBinaryStream_Sections__JpegImagePlg RenderwareBinaryStream_Sections = 402
RenderwareBinaryStream_Sections__TgaImagePlg RenderwareBinaryStream_Sections = 403
RenderwareBinaryStream_Sections__GifImagePlg RenderwareBinaryStream_Sections = 404
RenderwareBinaryStream_Sections__QuatPlg RenderwareBinaryStream_Sections = 405
RenderwareBinaryStream_Sections__SplinePvsPlg RenderwareBinaryStream_Sections = 406
RenderwareBinaryStream_Sections__MipmapPlg RenderwareBinaryStream_Sections = 407
RenderwareBinaryStream_Sections__MipmapkPlg RenderwareBinaryStream_Sections = 408
RenderwareBinaryStream_Sections__Font2d RenderwareBinaryStream_Sections = 409
RenderwareBinaryStream_Sections__IntersectionPlg RenderwareBinaryStream_Sections = 410
RenderwareBinaryStream_Sections__TiffImagePlg RenderwareBinaryStream_Sections = 411
RenderwareBinaryStream_Sections__PickPlg RenderwareBinaryStream_Sections = 412
RenderwareBinaryStream_Sections__BmpImagePlg RenderwareBinaryStream_Sections = 413
RenderwareBinaryStream_Sections__RasImagePlg RenderwareBinaryStream_Sections = 414
RenderwareBinaryStream_Sections__SkinFxPlg RenderwareBinaryStream_Sections = 415
RenderwareBinaryStream_Sections__VcatPlg RenderwareBinaryStream_Sections = 416
RenderwareBinaryStream_Sections__Path2d RenderwareBinaryStream_Sections = 417
RenderwareBinaryStream_Sections__Brush2d RenderwareBinaryStream_Sections = 418
RenderwareBinaryStream_Sections__Object2d RenderwareBinaryStream_Sections = 419
RenderwareBinaryStream_Sections__Shape2d RenderwareBinaryStream_Sections = 420
RenderwareBinaryStream_Sections__Scene2d RenderwareBinaryStream_Sections = 421
RenderwareBinaryStream_Sections__PickRegion2d RenderwareBinaryStream_Sections = 422
RenderwareBinaryStream_Sections__ObjectString2d RenderwareBinaryStream_Sections = 423
RenderwareBinaryStream_Sections__AnimationPlg2d RenderwareBinaryStream_Sections = 424
RenderwareBinaryStream_Sections__Animation2d RenderwareBinaryStream_Sections = 425
RenderwareBinaryStream_Sections__Keyframe2d RenderwareBinaryStream_Sections = 432
RenderwareBinaryStream_Sections__Maestro2d RenderwareBinaryStream_Sections = 433
RenderwareBinaryStream_Sections__Barycentric RenderwareBinaryStream_Sections = 434
RenderwareBinaryStream_Sections__PlatformIndependentTextureDictionaryTk RenderwareBinaryStream_Sections = 435
RenderwareBinaryStream_Sections__TocTk RenderwareBinaryStream_Sections = 436
RenderwareBinaryStream_Sections__TplTk RenderwareBinaryStream_Sections = 437
RenderwareBinaryStream_Sections__AltpipeTk RenderwareBinaryStream_Sections = 438
RenderwareBinaryStream_Sections__AnimationTk RenderwareBinaryStream_Sections = 439
RenderwareBinaryStream_Sections__SkinSplitTookit RenderwareBinaryStream_Sections = 440
RenderwareBinaryStream_Sections__CompressedKeyTk RenderwareBinaryStream_Sections = 441
RenderwareBinaryStream_Sections__GeometryConditioningPlg RenderwareBinaryStream_Sections = 442
RenderwareBinaryStream_Sections__WingPlg RenderwareBinaryStream_Sections = 443
RenderwareBinaryStream_Sections__GenericPipelineTk RenderwareBinaryStream_Sections = 444
RenderwareBinaryStream_Sections__LightmapConversionTk RenderwareBinaryStream_Sections = 445
RenderwareBinaryStream_Sections__FilesystemPlg RenderwareBinaryStream_Sections = 446
RenderwareBinaryStream_Sections__DictionaryTk RenderwareBinaryStream_Sections = 447
RenderwareBinaryStream_Sections__UvAnimationLinear RenderwareBinaryStream_Sections = 448
RenderwareBinaryStream_Sections__UvAnimationParameter RenderwareBinaryStream_Sections = 449
RenderwareBinaryStream_Sections__BinMeshPlg RenderwareBinaryStream_Sections = 1294
RenderwareBinaryStream_Sections__NativeDataPlg RenderwareBinaryStream_Sections = 1296
RenderwareBinaryStream_Sections__ZmodelerLock RenderwareBinaryStream_Sections = 61982
RenderwareBinaryStream_Sections__AtomicVisibilityDistance RenderwareBinaryStream_Sections = 39055872
RenderwareBinaryStream_Sections__ClumpVisibilityDistance RenderwareBinaryStream_Sections = 39055873
RenderwareBinaryStream_Sections__FrameVisibilityDistance RenderwareBinaryStream_Sections = 39055874
RenderwareBinaryStream_Sections__PipelineSet RenderwareBinaryStream_Sections = 39056115
RenderwareBinaryStream_Sections__Unused5 RenderwareBinaryStream_Sections = 39056116
RenderwareBinaryStream_Sections__TexdictionaryLink RenderwareBinaryStream_Sections = 39056117
RenderwareBinaryStream_Sections__SpecularMaterial RenderwareBinaryStream_Sections = 39056118
RenderwareBinaryStream_Sections__Unused8 RenderwareBinaryStream_Sections = 39056119
RenderwareBinaryStream_Sections__Effect2d RenderwareBinaryStream_Sections = 39056120
RenderwareBinaryStream_Sections__ExtraVertColour RenderwareBinaryStream_Sections = 39056121
RenderwareBinaryStream_Sections__CollisionModel RenderwareBinaryStream_Sections = 39056122
RenderwareBinaryStream_Sections__GtaHanim RenderwareBinaryStream_Sections = 39056123
RenderwareBinaryStream_Sections__ReflectionMaterial RenderwareBinaryStream_Sections = 39056124
RenderwareBinaryStream_Sections__Breakable RenderwareBinaryStream_Sections = 39056125
RenderwareBinaryStream_Sections__Frame RenderwareBinaryStream_Sections = 39056126
RenderwareBinaryStream_Sections__Unused16 RenderwareBinaryStream_Sections = 39056127
)
type RenderwareBinaryStream struct {
Code RenderwareBinaryStream_Sections
Size uint32
LibraryIdStamp uint32
Body interface{}
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent interface{}
_raw_Body []byte
_f_version bool
version int
}
func NewRenderwareBinaryStream() *RenderwareBinaryStream {
return &RenderwareBinaryStream{
}
}
func (this *RenderwareBinaryStream) Read(io *kaitai.Stream, parent interface{}, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp1, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Code = RenderwareBinaryStream_Sections(tmp1)
tmp2, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Size = uint32(tmp2)
tmp3, err := this._io.ReadU4le()
if err != nil {
return err
}
this.LibraryIdStamp = uint32(tmp3)
switch (this.Code) {
case RenderwareBinaryStream_Sections__Atomic:
tmp4, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp4 = tmp4
this._raw_Body = tmp4
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp5 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp5.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp5
case RenderwareBinaryStream_Sections__Geometry:
tmp6, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp6 = tmp6
this._raw_Body = tmp6
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp7 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp7.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp7
case RenderwareBinaryStream_Sections__TextureDictionary:
tmp8, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp8 = tmp8
this._raw_Body = tmp8
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp9 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp9.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp9
case RenderwareBinaryStream_Sections__GeometryList:
tmp10, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp10 = tmp10
this._raw_Body = tmp10
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp11 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp11.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp11
case RenderwareBinaryStream_Sections__TextureNative:
tmp12, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp12 = tmp12
this._raw_Body = tmp12
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp13 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp13.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp13
case RenderwareBinaryStream_Sections__Clump:
tmp14, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp14 = tmp14
this._raw_Body = tmp14
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp15 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp15.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp15
case RenderwareBinaryStream_Sections__FrameList:
tmp16, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp16 = tmp16
this._raw_Body = tmp16
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp17 := NewRenderwareBinaryStream_ListWithHeader()
err = tmp17.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp17
default:
tmp18, err := this._io.ReadBytes(int(this.Size))
if err != nil {
return err
}
tmp18 = tmp18
this._raw_Body = tmp18
}
return err
}
func (this *RenderwareBinaryStream) Version() (v int, err error) {
if (this._f_version) {
return this.version, nil
}
var tmp19 int;
if ((this.LibraryIdStamp & uint32(4294901760)) != 0) {
tmp19 = ((((this.LibraryIdStamp >> 14) & 261888) + 196608) | ((this.LibraryIdStamp >> 16) & 63))
} else {
tmp19 = (this.LibraryIdStamp << 8)
}
this.version = int(tmp19)
this._f_version = true
return this.version, nil
}
/**
* @see <a href="https://gtamods.com/wiki/RpClump">Source</a>
*/
type RenderwareBinaryStream_StructClump struct {
NumAtomics uint32
NumLights uint32
NumCameras uint32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_ListWithHeader
}
func NewRenderwareBinaryStream_StructClump() *RenderwareBinaryStream_StructClump {
return &RenderwareBinaryStream_StructClump{
}
}
func (this *RenderwareBinaryStream_StructClump) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_ListWithHeader, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp20, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumAtomics = uint32(tmp20)
tmp21, err := this._parent.Version()
if err != nil {
return err
}
if (tmp21 >= 208896) {
tmp22, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumLights = uint32(tmp22)
}
tmp23, err := this._parent.Version()
if err != nil {
return err
}
if (tmp23 >= 208896) {
tmp24, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumCameras = uint32(tmp24)
}
return err
}
/**
* @see <a href="https://gtamods.com/wiki/RpGeometry">Source</a>
*/
type RenderwareBinaryStream_StructGeometry struct {
Format uint32
NumTriangles uint32
NumVertices uint32
NumMorphTargets uint32
SurfProp *RenderwareBinaryStream_SurfaceProperties
Geometry *RenderwareBinaryStream_GeometryNonNative
MorphTargets []*RenderwareBinaryStream_MorphTarget
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_ListWithHeader
_f_numUvLayersRaw bool
numUvLayersRaw int
_f_isTextured bool
isTextured bool
_f_isNative bool
isNative bool
_f_numUvLayers bool
numUvLayers int
_f_isTextured2 bool
isTextured2 bool
_f_isPrelit bool
isPrelit bool
}
func NewRenderwareBinaryStream_StructGeometry() *RenderwareBinaryStream_StructGeometry {
return &RenderwareBinaryStream_StructGeometry{
}
}
func (this *RenderwareBinaryStream_StructGeometry) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_ListWithHeader, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp25, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Format = uint32(tmp25)
tmp26, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumTriangles = uint32(tmp26)
tmp27, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumVertices = uint32(tmp27)
tmp28, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumMorphTargets = uint32(tmp28)
tmp29, err := this._parent.Version()
if err != nil {
return err
}
if (tmp29 < 212992) {
tmp30 := NewRenderwareBinaryStream_SurfaceProperties()
err = tmp30.Read(this._io, this, this._root)
if err != nil {
return err
}
this.SurfProp = tmp30
}
tmp31, err := this.IsNative()
if err != nil {
return err
}
if (!(tmp31)) {
tmp32 := NewRenderwareBinaryStream_GeometryNonNative()
err = tmp32.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Geometry = tmp32
}
for i := 0; i < int(this.NumMorphTargets); i++ {
_ = i
tmp33 := NewRenderwareBinaryStream_MorphTarget()
err = tmp33.Read(this._io, this, this._root)
if err != nil {
return err
}
this.MorphTargets = append(this.MorphTargets, tmp33)
}
return err
}
func (this *RenderwareBinaryStream_StructGeometry) NumUvLayersRaw() (v int, err error) {
if (this._f_numUvLayersRaw) {
return this.numUvLayersRaw, nil
}
this.numUvLayersRaw = int(((this.Format & 16711680) >> 16))
this._f_numUvLayersRaw = true
return this.numUvLayersRaw, nil
}
func (this *RenderwareBinaryStream_StructGeometry) IsTextured() (v bool, err error) {
if (this._f_isTextured) {
return this.isTextured, nil
}
this.isTextured = bool((this.Format & 4) != 0)
this._f_isTextured = true
return this.isTextured, nil
}
func (this *RenderwareBinaryStream_StructGeometry) IsNative() (v bool, err error) {
if (this._f_isNative) {
return this.isNative, nil
}
this.isNative = bool((this.Format & 16777216) != 0)
this._f_isNative = true
return this.isNative, nil
}
func (this *RenderwareBinaryStream_StructGeometry) NumUvLayers() (v int, err error) {
if (this._f_numUvLayers) {
return this.numUvLayers, nil
}
var tmp34 int8;
tmp35, err := this.NumUvLayersRaw()
if err != nil {
return 0, err
}
if (tmp35 == 0) {
var tmp36 int8;
tmp37, err := this.IsTextured2()
if err != nil {
return 0, err
}
if (tmp37) {
tmp36 = 2
} else {
var tmp38 int8;
tmp39, err := this.IsTextured()
if err != nil {
return 0, err
}
if (tmp39) {
tmp38 = 1
} else {
tmp38 = 0
}
tmp36 = tmp38
}
tmp34 = tmp36
} else {
tmp40, err := this.NumUvLayersRaw()
if err != nil {
return 0, err
}
tmp34 = tmp40
}
this.numUvLayers = int(tmp34)
this._f_numUvLayers = true
return this.numUvLayers, nil
}
func (this *RenderwareBinaryStream_StructGeometry) IsTextured2() (v bool, err error) {
if (this._f_isTextured2) {
return this.isTextured2, nil
}
this.isTextured2 = bool((this.Format & 128) != 0)
this._f_isTextured2 = true
return this.isTextured2, nil
}
func (this *RenderwareBinaryStream_StructGeometry) IsPrelit() (v bool, err error) {
if (this._f_isPrelit) {
return this.isPrelit, nil
}
this.isPrelit = bool((this.Format & 8) != 0)
this._f_isPrelit = true
return this.isPrelit, nil
}
type RenderwareBinaryStream_GeometryNonNative struct {
PrelitColors []*RenderwareBinaryStream_Rgba
UvLayers []*RenderwareBinaryStream_UvLayer
Triangles []*RenderwareBinaryStream_Triangle
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_StructGeometry
}
func NewRenderwareBinaryStream_GeometryNonNative() *RenderwareBinaryStream_GeometryNonNative {
return &RenderwareBinaryStream_GeometryNonNative{
}
}
func (this *RenderwareBinaryStream_GeometryNonNative) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_StructGeometry, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp41, err := this._parent.IsPrelit()
if err != nil {
return err
}
if (tmp41) {
for i := 0; i < int(this._parent.NumVertices); i++ {
_ = i
tmp42 := NewRenderwareBinaryStream_Rgba()
err = tmp42.Read(this._io, this, this._root)
if err != nil {
return err
}
this.PrelitColors = append(this.PrelitColors, tmp42)
}
}
tmp43, err := this._parent.NumUvLayers()
if err != nil {
return err
}
for i := 0; i < int(tmp43); i++ {
_ = i
tmp44 := NewRenderwareBinaryStream_UvLayer(this._parent.NumVertices)
err = tmp44.Read(this._io, this, this._root)
if err != nil {
return err
}
this.UvLayers = append(this.UvLayers, tmp44)
}
for i := 0; i < int(this._parent.NumTriangles); i++ {
_ = i
tmp45 := NewRenderwareBinaryStream_Triangle()
err = tmp45.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Triangles = append(this.Triangles, tmp45)
}
return err
}
/**
* @see <a href="https://gtamods.com/wiki/Geometry_List_(RW_Section)#Structure">Source</a>
*/
type RenderwareBinaryStream_StructGeometryList struct {
NumGeometries uint32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_ListWithHeader
}
func NewRenderwareBinaryStream_StructGeometryList() *RenderwareBinaryStream_StructGeometryList {
return &RenderwareBinaryStream_StructGeometryList{
}
}
func (this *RenderwareBinaryStream_StructGeometryList) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_ListWithHeader, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp46, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumGeometries = uint32(tmp46)
return err
}
type RenderwareBinaryStream_Rgba struct {
R uint8
G uint8
B uint8
A uint8
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_GeometryNonNative
}
func NewRenderwareBinaryStream_Rgba() *RenderwareBinaryStream_Rgba {
return &RenderwareBinaryStream_Rgba{
}
}
func (this *RenderwareBinaryStream_Rgba) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_GeometryNonNative, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp47, err := this._io.ReadU1()
if err != nil {
return err
}
this.R = tmp47
tmp48, err := this._io.ReadU1()
if err != nil {
return err
}
this.G = tmp48
tmp49, err := this._io.ReadU1()
if err != nil {
return err
}
this.B = tmp49
tmp50, err := this._io.ReadU1()
if err != nil {
return err
}
this.A = tmp50
return err
}
type RenderwareBinaryStream_Sphere struct {
X float32
Y float32
Z float32
Radius float32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_MorphTarget
}
func NewRenderwareBinaryStream_Sphere() *RenderwareBinaryStream_Sphere {
return &RenderwareBinaryStream_Sphere{
}
}
func (this *RenderwareBinaryStream_Sphere) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_MorphTarget, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp51, err := this._io.ReadF4le()
if err != nil {
return err
}
this.X = float32(tmp51)
tmp52, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Y = float32(tmp52)
tmp53, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Z = float32(tmp53)
tmp54, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Radius = float32(tmp54)
return err
}
type RenderwareBinaryStream_MorphTarget struct {
BoundingSphere *RenderwareBinaryStream_Sphere
HasVertices uint32
HasNormals uint32
Vertices []*RenderwareBinaryStream_Vector3d
Normals []*RenderwareBinaryStream_Vector3d
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_StructGeometry
}
func NewRenderwareBinaryStream_MorphTarget() *RenderwareBinaryStream_MorphTarget {
return &RenderwareBinaryStream_MorphTarget{
}
}
func (this *RenderwareBinaryStream_MorphTarget) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_StructGeometry, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp55 := NewRenderwareBinaryStream_Sphere()
err = tmp55.Read(this._io, this, this._root)
if err != nil {
return err
}
this.BoundingSphere = tmp55
tmp56, err := this._io.ReadU4le()
if err != nil {
return err
}
this.HasVertices = uint32(tmp56)
tmp57, err := this._io.ReadU4le()
if err != nil {
return err
}
this.HasNormals = uint32(tmp57)
if (this.HasVertices != 0) {
for i := 0; i < int(this._parent.NumVertices); i++ {
_ = i
tmp58 := NewRenderwareBinaryStream_Vector3d()
err = tmp58.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Vertices = append(this.Vertices, tmp58)
}
}
if (this.HasNormals != 0) {
for i := 0; i < int(this._parent.NumVertices); i++ {
_ = i
tmp59 := NewRenderwareBinaryStream_Vector3d()
err = tmp59.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Normals = append(this.Normals, tmp59)
}
}
return err
}
/**
* @see <a href="https://gtamods.com/wiki/Atomic_(RW_Section)#Structure">Source</a>
*/
type RenderwareBinaryStream_StructAtomic struct {
FrameIndex uint32
GeometryIndex uint32
FlagRender bool
_unnamed3 bool
FlagCollisionTest bool
_unnamed5 uint64
Unused uint32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_ListWithHeader
}
func NewRenderwareBinaryStream_StructAtomic() *RenderwareBinaryStream_StructAtomic {
return &RenderwareBinaryStream_StructAtomic{
}
}
func (this *RenderwareBinaryStream_StructAtomic) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_ListWithHeader, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp60, err := this._io.ReadU4le()
if err != nil {
return err
}
this.FrameIndex = uint32(tmp60)
tmp61, err := this._io.ReadU4le()
if err != nil {
return err
}
this.GeometryIndex = uint32(tmp61)
tmp62, err := this._io.ReadBitsIntLe(1)
if err != nil {
return err
}
this.FlagRender = tmp62 != 0
tmp63, err := this._io.ReadBitsIntLe(1)
if err != nil {
return err
}
this._unnamed3 = tmp63 != 0
tmp64, err := this._io.ReadBitsIntLe(1)
if err != nil {
return err
}
this.FlagCollisionTest = tmp64 != 0
tmp65, err := this._io.ReadBitsIntLe(29)
if err != nil {
return err
}
this._unnamed5 = tmp65
this._io.AlignToByte()
tmp66, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Unused = uint32(tmp66)
return err
}
/**
* @see <a href="https://gtamods.com/wiki/RpGeometry">Source</a>
*/
type RenderwareBinaryStream_SurfaceProperties struct {
Ambient float32
Specular float32
Diffuse float32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_StructGeometry
}
func NewRenderwareBinaryStream_SurfaceProperties() *RenderwareBinaryStream_SurfaceProperties {
return &RenderwareBinaryStream_SurfaceProperties{
}
}
func (this *RenderwareBinaryStream_SurfaceProperties) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_StructGeometry, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp67, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Ambient = float32(tmp67)
tmp68, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Specular = float32(tmp68)
tmp69, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Diffuse = float32(tmp69)
return err
}
/**
* @see <a href="https://gtamods.com/wiki/Frame_List_(RW_Section)#Structure">Source</a>
*/
type RenderwareBinaryStream_StructFrameList struct {
NumFrames uint32
Frames []*RenderwareBinaryStream_Frame
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_ListWithHeader
}
func NewRenderwareBinaryStream_StructFrameList() *RenderwareBinaryStream_StructFrameList {
return &RenderwareBinaryStream_StructFrameList{
}
}
func (this *RenderwareBinaryStream_StructFrameList) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_ListWithHeader, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp70, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumFrames = uint32(tmp70)
for i := 0; i < int(this.NumFrames); i++ {
_ = i
tmp71 := NewRenderwareBinaryStream_Frame()
err = tmp71.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Frames = append(this.Frames, tmp71)
}
return err
}
/**
* @see <a href="https://gtamods.com/wiki/Frame_List_(RW_Section)#Structure">Source</a>
*/
type RenderwareBinaryStream_Matrix struct {
Entries []*RenderwareBinaryStream_Vector3d
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_Frame
}
func NewRenderwareBinaryStream_Matrix() *RenderwareBinaryStream_Matrix {
return &RenderwareBinaryStream_Matrix{
}
}
func (this *RenderwareBinaryStream_Matrix) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_Frame, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
for i := 0; i < int(3); i++ {
_ = i
tmp72 := NewRenderwareBinaryStream_Vector3d()
err = tmp72.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp72)
}
return err
}
/**
* @see <a href="https://gtamods.com/wiki/Frame_List_(RW_Section)#Structure">Source</a>
*/
type RenderwareBinaryStream_Vector3d struct {
X float32
Y float32
Z float32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent interface{}
}
func NewRenderwareBinaryStream_Vector3d() *RenderwareBinaryStream_Vector3d {
return &RenderwareBinaryStream_Vector3d{
}
}
func (this *RenderwareBinaryStream_Vector3d) Read(io *kaitai.Stream, parent interface{}, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp73, err := this._io.ReadF4le()
if err != nil {
return err
}
this.X = float32(tmp73)
tmp74, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Y = float32(tmp74)
tmp75, err := this._io.ReadF4le()
if err != nil {
return err
}
this.Z = float32(tmp75)
return err
}
/**
* Typical structure used by many data types in RenderWare binary
* stream. Substream contains a list of binary stream entries,
* first entry always has type "struct" and carries some specific
* binary data it in, determined by the type of parent. All other
* entries, beside the first one, are normal, self-describing
* records.
*/
type RenderwareBinaryStream_ListWithHeader struct {
Code []byte
HeaderSize uint32
LibraryIdStamp uint32
Header interface{}
Entries []*RenderwareBinaryStream
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream
_raw_Header []byte
_f_version bool
version int
}
func NewRenderwareBinaryStream_ListWithHeader() *RenderwareBinaryStream_ListWithHeader {
return &RenderwareBinaryStream_ListWithHeader{
}
}
func (this *RenderwareBinaryStream_ListWithHeader) Read(io *kaitai.Stream, parent *RenderwareBinaryStream, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp76, err := this._io.ReadBytes(int(4))
if err != nil {
return err
}
tmp76 = tmp76
this.Code = tmp76
if !(bytes.Equal(this.Code, []uint8{1, 0, 0, 0})) {
return kaitai.NewValidationNotEqualError([]uint8{1, 0, 0, 0}, this.Code, this._io, "/types/list_with_header/seq/0")
}
tmp77, err := this._io.ReadU4le()
if err != nil {
return err
}
this.HeaderSize = uint32(tmp77)
tmp78, err := this._io.ReadU4le()
if err != nil {
return err
}
this.LibraryIdStamp = uint32(tmp78)
switch (this._parent.Code) {
case RenderwareBinaryStream_Sections__Atomic:
tmp79, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp79 = tmp79
this._raw_Header = tmp79
_io__raw_Header := kaitai.NewStream(bytes.NewReader(this._raw_Header))
tmp80 := NewRenderwareBinaryStream_StructAtomic()
err = tmp80.Read(_io__raw_Header, this, this._root)
if err != nil {
return err
}
this.Header = tmp80
case RenderwareBinaryStream_Sections__Geometry:
tmp81, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp81 = tmp81
this._raw_Header = tmp81
_io__raw_Header := kaitai.NewStream(bytes.NewReader(this._raw_Header))
tmp82 := NewRenderwareBinaryStream_StructGeometry()
err = tmp82.Read(_io__raw_Header, this, this._root)
if err != nil {
return err
}
this.Header = tmp82
case RenderwareBinaryStream_Sections__TextureDictionary:
tmp83, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp83 = tmp83
this._raw_Header = tmp83
_io__raw_Header := kaitai.NewStream(bytes.NewReader(this._raw_Header))
tmp84 := NewRenderwareBinaryStream_StructTextureDictionary()
err = tmp84.Read(_io__raw_Header, this, this._root)
if err != nil {
return err
}
this.Header = tmp84
case RenderwareBinaryStream_Sections__GeometryList:
tmp85, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp85 = tmp85
this._raw_Header = tmp85
_io__raw_Header := kaitai.NewStream(bytes.NewReader(this._raw_Header))
tmp86 := NewRenderwareBinaryStream_StructGeometryList()
err = tmp86.Read(_io__raw_Header, this, this._root)
if err != nil {
return err
}
this.Header = tmp86
case RenderwareBinaryStream_Sections__Clump:
tmp87, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp87 = tmp87
this._raw_Header = tmp87
_io__raw_Header := kaitai.NewStream(bytes.NewReader(this._raw_Header))
tmp88 := NewRenderwareBinaryStream_StructClump()
err = tmp88.Read(_io__raw_Header, this, this._root)
if err != nil {
return err
}
this.Header = tmp88
case RenderwareBinaryStream_Sections__FrameList:
tmp89, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp89 = tmp89
this._raw_Header = tmp89
_io__raw_Header := kaitai.NewStream(bytes.NewReader(this._raw_Header))
tmp90 := NewRenderwareBinaryStream_StructFrameList()
err = tmp90.Read(_io__raw_Header, this, this._root)
if err != nil {
return err
}
this.Header = tmp90
default:
tmp91, err := this._io.ReadBytes(int(this.HeaderSize))
if err != nil {
return err
}
tmp91 = tmp91
this._raw_Header = tmp91
}
for i := 1;; i++ {
tmp92, err := this._io.EOF()
if err != nil {
return err
}
if tmp92 {
break
}
tmp93 := NewRenderwareBinaryStream()
err = tmp93.Read(this._io, this, nil)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp93)
}
return err
}
func (this *RenderwareBinaryStream_ListWithHeader) Version() (v int, err error) {
if (this._f_version) {
return this.version, nil
}
var tmp94 int;
if ((this.LibraryIdStamp & uint32(4294901760)) != 0) {
tmp94 = ((((this.LibraryIdStamp >> 14) & 261888) + 196608) | ((this.LibraryIdStamp >> 16) & 63))
} else {
tmp94 = (this.LibraryIdStamp << 8)
}
this.version = int(tmp94)
this._f_version = true
return this.version, nil
}
type RenderwareBinaryStream_Triangle struct {
Vertex2 uint16
Vertex1 uint16
MaterialId uint16
Vertex3 uint16
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_GeometryNonNative
}
func NewRenderwareBinaryStream_Triangle() *RenderwareBinaryStream_Triangle {
return &RenderwareBinaryStream_Triangle{
}
}
func (this *RenderwareBinaryStream_Triangle) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_GeometryNonNative, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp95, err := this._io.ReadU2le()
if err != nil {
return err
}
this.Vertex2 = uint16(tmp95)
tmp96, err := this._io.ReadU2le()
if err != nil {
return err
}
this.Vertex1 = uint16(tmp96)
tmp97, err := this._io.ReadU2le()
if err != nil {
return err
}
this.MaterialId = uint16(tmp97)
tmp98, err := this._io.ReadU2le()
if err != nil {
return err
}
this.Vertex3 = uint16(tmp98)
return err
}
/**
* @see <a href="https://gtamods.com/wiki/Frame_List_(RW_Section)#Structure">Source</a>
*/
type RenderwareBinaryStream_Frame struct {
RotationMatrix *RenderwareBinaryStream_Matrix
Position *RenderwareBinaryStream_Vector3d
CurFrameIdx int32
MatrixCreationFlags uint32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_StructFrameList
}
func NewRenderwareBinaryStream_Frame() *RenderwareBinaryStream_Frame {
return &RenderwareBinaryStream_Frame{
}
}
func (this *RenderwareBinaryStream_Frame) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_StructFrameList, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp99 := NewRenderwareBinaryStream_Matrix()
err = tmp99.Read(this._io, this, this._root)
if err != nil {
return err
}
this.RotationMatrix = tmp99
tmp100 := NewRenderwareBinaryStream_Vector3d()
err = tmp100.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Position = tmp100
tmp101, err := this._io.ReadS4le()
if err != nil {
return err
}
this.CurFrameIdx = int32(tmp101)
tmp102, err := this._io.ReadU4le()
if err != nil {
return err
}
this.MatrixCreationFlags = uint32(tmp102)
return err
}
type RenderwareBinaryStream_TexCoord struct {
U float32
V float32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_UvLayer
}
func NewRenderwareBinaryStream_TexCoord() *RenderwareBinaryStream_TexCoord {
return &RenderwareBinaryStream_TexCoord{
}
}
func (this *RenderwareBinaryStream_TexCoord) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_UvLayer, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp103, err := this._io.ReadF4le()
if err != nil {
return err
}
this.U = float32(tmp103)
tmp104, err := this._io.ReadF4le()
if err != nil {
return err
}
this.V = float32(tmp104)
return err
}
type RenderwareBinaryStream_UvLayer struct {
TexCoords []*RenderwareBinaryStream_TexCoord
NumVertices uint32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_GeometryNonNative
}
func NewRenderwareBinaryStream_UvLayer(numVertices uint32) *RenderwareBinaryStream_UvLayer {
return &RenderwareBinaryStream_UvLayer{
NumVertices: numVertices,
}
}
func (this *RenderwareBinaryStream_UvLayer) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_GeometryNonNative, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
for i := 0; i < int(this.NumVertices); i++ {
_ = i
tmp105 := NewRenderwareBinaryStream_TexCoord()
err = tmp105.Read(this._io, this, this._root)
if err != nil {
return err
}
this.TexCoords = append(this.TexCoords, tmp105)
}
return err
}
type RenderwareBinaryStream_StructTextureDictionary struct {
NumTextures uint32
_io *kaitai.Stream
_root *RenderwareBinaryStream
_parent *RenderwareBinaryStream_ListWithHeader
}
func NewRenderwareBinaryStream_StructTextureDictionary() *RenderwareBinaryStream_StructTextureDictionary {
return &RenderwareBinaryStream_StructTextureDictionary{
}
}
func (this *RenderwareBinaryStream_StructTextureDictionary) Read(io *kaitai.Stream, parent *RenderwareBinaryStream_ListWithHeader, root *RenderwareBinaryStream) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp106, err := this._io.ReadU4le()
if err != nil {
return err
}
this.NumTextures = uint32(tmp106)
return err
}