Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-08 10:57:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-08 10:57:29 +0400
commit76a657bf4e61e17be51420fa8ee365974a856838 (patch)
tree56363951bfc5a25b0b7eec6093838efffa863389 /io_scene_x3d
parenta06a47b218d703b29a694fec000f9d0bf031da0f (diff)
initial support for exporting textures to h3d
Diffstat (limited to 'io_scene_x3d')
-rw-r--r--io_scene_x3d/export_x3d.py40
1 files changed, 35 insertions, 5 deletions
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 5a18c16b..6e6d9189 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -903,8 +903,8 @@ def export(file,
fw('%s<ComposedShader DEF=%s language="GLSL" >\n' % (ident, material_id))
ident += '\t'
- shader_url_frag = 'shaders/glsl_%s.frag' % material_id
- shader_url_vert = 'shaders/glsl_%s.vert' % material_id
+ shader_url_frag = 'shaders/glsl_%s.frag' % material_id[1:-1]
+ shader_url_vert = 'shaders/glsl_%s.vert' % material_id[1:-1]
# write files
shader_dir = os.path.join(dirname, 'shaders')
@@ -964,11 +964,41 @@ def export(file,
elif uniform['type'] == gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER:
if uniform['datatype'] == gpu.GPU_DATA_1I:
if 1:
- value = ' '.join(['%d' % f for f in uniform['texpixels']])
+ tex = uniform['texpixels']
+ value = []
+ for i in range(0, len(tex) - 1, 4):
+ col = tex[i:i + 4]
+ value += ['0x%.8x' % (col[0] + (col[1] << 8) + (col[2] << 16) + (col[3] << 24))]
+ print(len(value))
+
+
+ fw('%s<field name="%s" type="SFNode" accessType="inputOutput">\n' % (ident, uniform['varname']))
+
+ ident += '\t'
+
+ ident_step = ident + (' ' * (-len(ident) + \
+ fw('%s<PixelTexture \n' % ident)))
+ fw(ident_step + 'repeatS="true"\n')
+ fw(ident_step + 'repeatT="true"\n')
+
+ fw(ident_step + 'image="1 256 4 %s"\n' % " ".join(value))
+
+ fw(ident_step + '/>\n')
+
+ ident = ident[:-1]
+
+ fw('%s</field>\n' % ident)
+
+ #for i in range(0, 10, 4)
+ #value = ' '.join(['%d' % f for f in uniform['texpixels']])
# value = ' '.join(['%.6g' % (f / 256) for f in uniform['texpixels']])
+
- fw('%s<field name="%s" type="SFInt32" accessType="inputOutput" value="%s" />\n' % (ident, uniform['varname'], value))
- print('test', len(uniform['texpixels']))
+ #fw('%s<field name="%s" type="SFInt32" accessType="inputOutput" value="%s" />\n' % (ident, uniform['varname'], value))
+ #print('test', len(uniform['texpixels']))
+
+
+
else:
assert(0)