• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python io.StreamWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中s3py.io.StreamWriter的典型用法代码示例。如果您正苦于以下问题:Python StreamWriter类的具体用法?Python StreamWriter怎么用?Python StreamWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了StreamWriter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: write

 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     s.chars(self.TAG)
     s.u32(self.version)
     cBlends = len(self.blends)
     cLods = 0
     if cBlends:
         len(self.blends[0].lods)
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:geometry.py


示例2: write

 def write(self, stream, resources=None):
     s = StreamWriter(stream)
     flags = 0
     flags |= (self.type << 0)
     if self.static: flags |= (1 << 1)
     flags |= (self.unknown << 4)
     s.u8(flags)
     return self
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:__init__.py


示例3: write

 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     s.u32(self.type)
     for i in range(3): s.f32(self.origin[i])
     for i in range(3): s.f32(self.normal[i])
     for i in range(3): s.f32(self.x_axis[i])
     for i in range(3): s.f32(self.y_axis[i])
     s.f32(self.pair_offset)
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:lights.py


示例4: serialize

    def serialize(self,complate,stream,resources):
        def write_element(s,tgi_list):
            def write_complate_string(string,s):
                if not string:
                    s.i8(0)
                    return
                if string in self.complate_string_lookup:
                    idx = self.complate_string_lookup[string]
                    if idx > 0x40:
                        s.i8(0x40)
                    s.i8(idx &0x3F)
                else:
                    x = len(string)


                pass
            def write_typecode(value,s,tgi_list):
                if isinstance(value,str):
                    s.i8(0x01)
                    write_complate_string(value,s)
                elif isinstance(value,list):
                    if len(value) == 4:
                        s.i8(0x02)
                        for e in value: s.u8(e)
                    elif len(value) == 2:
                        s.i8(0x05)
                        for e in value: s.f32(e)
                    elif len(value) == 3:
                        s.i8(0x06)
                        for e in value: s.f32(e)
                elif isinstance(value,Resource):
                    s.i8(0x03)
                    s.i8(tgi_list.get_resource_index(value))
                elif isinstance(value,float):
                    s.i8(0x04)
                    s.f32(value)
                elif isinstance(value,bool):
                    s.i8(0x07)
                    s.i8(1 if value else 0)
                else:
                    raise Exception ("Unable to handle typecode data %" %value)


                pass

            pass
        assert isinstance(complate,ComplateElement)
        s= StreamWriter(stream)
        s.i16(complate.priority)
        preset_tgi = TGIList(use_length=True)
        preset_tgi.begin_write(stream)

        raise NotImplementedError()
开发者ID:markmanching,项目名称:s3py,代码行数:53,代码来源:catalog.py


示例5: write_rcol

 def write_rcol(self, stream, rcol):
     s = StreamWriter(stream)
     self.write_tag(stream)
     s.u32(self.version)
     s.i32(len(self.outcomes))
     for outcome in self.outcomes: outcome.write(stream, rcol)
     s.u32(DEADBEEF)
     s.u32(self.flags)
     DecisionGraphNode.write(self, stream, rcol)
开发者ID:markmanching,项目名称:s3py,代码行数:9,代码来源:jazz.py


示例6: write_rcol

 def write_rcol(self, stream, rcol):
     self.write_tag(stream)
     s = StreamWriter(stream)
     s.u32(self.version)
     cBones = len(self.bones)
     s.i32(cBones)
     for i in range(cBones): s.hash(self.bones[i].name)
     for bone in self.bones:
         s.m43(bone.inverse_bind_pose)
开发者ID:markmanching,项目名称:s3py,代码行数:9,代码来源:geometry.py


示例7: write

 def write(self, stream, resources=None):
     s = StreamWriter(stream)
     s.u32(self.version)
     tgi = TGIList()
     tgi.begin_write(stream)
     for shader_key in self.shader_keys: shader_key.write(stream, tgi)
     s.u32(tgi.get_resource_index(self.sub_skin_ramp))
     s.u32(tgi.get_resource_index(self.tone_ramp))
     for texture_key in self.texture_keys: texture_key.write(stream, tgi)
     s.u8(self.is_dominant)
开发者ID:markmanching,项目名称:s3py,代码行数:10,代码来源:catalog.py


示例8: write_presets

 def write_presets(cls, stream,presets, resources):
     s = StreamWriter(stream)
     s.i32(len(presets))
     ce = ComplateEncoder()
     for preset in presets:
         assert isinstance(preset,cls.BuildBuyPreset)
         s.i8(preset.unk1)
         if preset.unk1 != 1:
             s.i32(preset.unk2)
         preset_ptr = StreamPtr.begin_write(s)
         ce.serialize(preset.complate,stream,resources)
         preset_ptr.end()
         s.u32(preset.id)
开发者ID:markmanching,项目名称:s3py,代码行数:13,代码来源:catalog.py


示例9: write_rcol

 def write_rcol(self, stream, rcol):
     s = StreamWriter(stream)
     self.write_tag(stream)
     s.u32(self.version)
     s.f32(self.framerate)
     cFrames = len(self.frames)
     s.i32(cFrames)
     data_pos = stream.tell() + (cFrames * 4)
     for frame in self.frames:
         s.u32(data_pos)
         data_pos += len(frame)
     for frame in self.frames:
         stream.write(frame)
开发者ID:markmanching,项目名称:s3py,代码行数:13,代码来源:material.py


示例10: write

 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     keys = self.names.keys()
     s.u32(len(keys))
     for key in keys:
         s.u64(key)
         s.p32(self.names[key])
开发者ID:markmanching,项目名称:s3py,代码行数:7,代码来源:package.py


示例11: write_rcol

    def write_rcol(self, stream, rcol):
        s = StreamWriter(stream)
        s.u32(self.version)
        s.i32(len(self.deltas))

        for hash in self.deltas:
            delta = self.deltas[hash]
            s.u32(hash)
            delta.write(stream)
开发者ID:markmanching,项目名称:s3py,代码行数:9,代码来源:rig.py


示例12: write_rcol

 def write_rcol(self, stream, rcol):
     s = StreamWriter(stream)
     self.write_tag(stream)
     s.u32(self.version)
     cFootprints = len(self.footprint_polygons)
     s.i8(cFootprints)
     for footprint_index in range(cFootprints): self.footprint_polygons[footprint_index].write(stream)
     cSlots = len(self.routing_slot_footprint_polygons)
     s.i8(cSlots)
     for slot_index in range(cSlots): self.routing_slot_footprint_polygons[slot_index].write(stream)
开发者ID:markmanching,项目名称:s3py,代码行数:10,代码来源:__init__.py


示例13: write_pointer

 def write_pointer(self, stream):
     self.size32 = 1
     t = type(self.value)
     if isinstance(self.value, list):
         self.size32 = len(self.value)
         t = type(self.value[0])
     if t == float:
         self.type_code = self.TYPE.FLOAT
     elif t == int:
         self.type_code = self.TYPE.INT
     elif  t == ExternalResource:
         self.type_code = self.TYPE.TEXTURE
     elif t == ResourceKey:
         self.size32 = 4
         self.type_code = self.TYPE.TEXTURE
     else:
         raise NotImplementedError("Serialization of type %s is not supported in this format!" % t)
     s = StreamWriter(stream)
     s.hash(self.name)
     s.u32(self.type_code)
     s.u32(self.size32)
     self.pointer = StreamPtr.begin_write(s)
开发者ID:markmanching,项目名称:s3py,代码行数:22,代码来源:material.py


示例14: write_rcol

 def write_rcol(self, stream, rcol):
     self.write_tag(stream)
     s = StreamWriter(stream)
     s.u32(self.version)
     cLights = len(self.lights)
     cOccluders = len(self.occluders)
     s.u32(4 + (cLights * 128) + (cOccluders * 14))
     s.u8(cLights)
     s.u8(cOccluders)
     s.u16(cOccluders * 14)
     for light in self.lights:
         start = stream.tell()
         light.write_rcol(stream)
         end = stream.tell()
         size = end - start
         blank = 128 - size
         dwords = int(blank / 4)
         for i in range(int(dwords)): s.u32(0)
     for occluder in self.occluders:
         occluder.write_rcol(stream)
开发者ID:markmanching,项目名称:s3py,代码行数:20,代码来源:lights.py



注:本文中的s3py.io.StreamWriter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python database.Connection类代码示例发布时间:2022-05-27
下一篇:
Python io.StreamReader类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap