[DEV] set some updates

This commit is contained in:
Edouard DUPIN 2021-05-03 16:52:11 +02:00
parent d5ae92d240
commit 8d320ad441
487 changed files with 1313 additions and 1577 deletions

View File

@ -22,17 +22,7 @@
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-ephysics"> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-ewol">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scenarium-logger">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-etk">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
</attributes> </attributes>
@ -42,7 +32,22 @@
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-ewol"> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-etk">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scenarium-logger">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-ephysics">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/loader3d">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="module" value="true"/>
</attributes> </attributes>

View File

@ -0,0 +1,164 @@
# add this folder in ~/.config/blender/2.66/scripts/addons
bl_info = {
"name": "EGE Mesh file format emf",
"author": "Edouard DUPIN",
"blender": (2, 80, 0),
"location": "File > Import-Export",
"description": "Import-Export emf, Import EMF mesh, UV's, materials and textures",
"category": "Import-Export"}
if "bpy" in locals():
import imp
if "import_emf" in locals():
imp.reload(import_emf)
if "export_emf" in locals():
imp.reload(export_emf)
import bpy
from bpy.props import (
BoolProperty,
FloatProperty,
StringProperty,
EnumProperty,
)
from bpy_extras.io_utils import (
ImportHelper,
ExportHelper,
orientation_helper,
path_reference_mode,
axis_conversion,
)
class ImportEMF(bpy.types.Operator, ImportHelper):
"""Load a Wavefront EMF File"""
bl_idname = "import_scene.emf"
bl_label = "Import EMF"
bl_options = {'PRESET', 'UNDO'}
filename_ext = ".emf"
filter_glob = StringProperty(
default="*.emf",
options={'HIDDEN'},
)
def execute(self, context):
# print("Selected: " + context.active_object.name)
from . import import_obj
keywords = self.as_keywords(ignore=("filter_glob",
"split_mode",
))
return import_obj.load(self, context, **keywords)
def draw(self, context):
layout = self.layout
row = layout.row(align=True)
row = layout.split(percentage=0.67)
row.prop(self, "global_clamp_size")
layout.prop(self, "use_image_search")
#@orientation_helper(axis_forward='-Z', axis_up='Y')
class ExportEMF(bpy.types.Operator, ExportHelper):
"""Save a Wavefront EMF File"""
bl_idname = "export_scene.emf"
bl_label = 'Export EMF'
bl_options = {'PRESET'}
filename_ext = ".emf"
filter_glob = StringProperty(
default="*.emf",
options={'HIDDEN'},
)
# context group
use_selection = BoolProperty(
name="Selection Only",
description="Export selected objects only",
default=True,
)
# generate binary file
use_binary = BoolProperty(
name="Binary",
description="Export the file in binary mode",
default=False,
)
global_scale = FloatProperty(
name="Scale",
description="Scale all data",
min=0.01, max=1000.0,
soft_min=0.01,
soft_max=1000.0,
default=1.0,
)
collision_object_name = StringProperty(
name="Collision root name (strat with)",
description="The top-level name that will contain the physics shapes",
default="phys"
)
path_mode = path_reference_mode
check_extension = True
def execute(self, context):
from . import export_emf
from mathutils import Matrix
keywords = self.as_keywords(ignore=("global_scale",
"check_existing",
"filter_glob",
))
global_matrix = Matrix()
global_matrix[0][0] = \
global_matrix[1][1] = \
global_matrix[2][2] = self.global_scale
return export_emf.save(self, context, **keywords)
def menu_func_import(self, context):
self.layout.operator(ImportEMF.bl_idname, text="Ewol mesh file (.emf)")
def menu_func_export(self, context):
self.layout.operator(ExportEMF.bl_idname, text="Ewol mesh File (.emf)")
classes = (
ImportEMF,
ExportEMF,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
def unregister():
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()

View File

@ -0,0 +1,687 @@
import os
import time
import bpy
import mathutils
import bpy_extras.io_utils
EXPORT_COLLISION_NAME = ""
#blender myscene.blend --background --python myscript.py
def getChildren(obj):
children = []
for ob in bpy.data.objects:
if ob.parent == obj:
children.append(ob)
return children
import bpy
from bpy.props import *
import mathutils, math, struct
from mathutils import *
import os
from os import remove
import time
import bpy_extras
from bpy_extras.io_utils import ExportHelper
import time
import shutil
"""
Usage Notes:
To create a compound physics collision shape for a mesh in blender:
1. place the 3D cursor at the origin of the mesh object.
2. Add > Empty, name it "physics"
3. Create a physics shape with Add > Mesh > Cube, UV Sphere, Cylinder, Cone or create an arbitrary mesh for a ConvexHull shape.
4. Parent the new shape to the "physics" Empty.
5. The mesh name must start with: Box, Sphere, Cylinder, Cone, Capsule, or ConvexHull, depending on the shape you want.
6. Position and scale the shape object, but do not modify the internal vertices, unless it is a ConvexHull type.
7. Repeat step 3-6 until your shape is complete. Shapes can only be a 1-level deep hierarchy.
8. IMPORTANT: Select the empty object you named "physics"
9. Click File > Export > Physics Shapes (.yaml)
"""
"""
use_y_up = BoolProperty(name="Convert To Y-Up",
description="Converts the values to a Y-Axis Up coordinate system",
default=True)
"""
def out_point3( v ):
return "%g %g %g" % ( v.x, v.y, v.z )
def out_scale3( s ):
return "%g %g %g" % ( s.x, s.y, s.z )
def out_quaternion( q ):
return "%g %g %g %g" % ( q.x, q.y, q.z, q.w )
def get_physics_shape(obj, mainObjScale):
shape = ""
props = { }
name = obj.name.lower()
scale = Vector(( abs(obj.scale.x), abs(obj.scale.y), abs(obj.scale.z) ))
# BOX
if name.startswith('box') \
or name.startswith('cube'):
shape = "Box"
props["half-extents"] = out_scale3( scale )
# SPHERE
elif name.startswith('sph'):
shape = "Sphere"
props["radius"] = obj.scale.x * mainObjScale.x
# CONE
elif name.startswith('cone'):
shape = "Cone"
props["radius"] = (obj.scale.x + obj.scale.y)*0.5
props["size"] = obj.scale.z * 2.0
# CYLINDER
elif name.startswith('cyl'):
shape = "Cylinder"
props["radius"] = (obj.scale.x + obj.scale.y)*0.5
props["size"] = obj.scale.z * 2.0
# CAPSULE
elif name.startswith('cap'):
shape = "Capsule"
props["radius"] = (obj.scale.x + obj.scale.y)*0.5
props["size"] = obj.scale.z * 2.0
# CONVEX-HULL
elif name.startswith('convex'):
shape = "ConvexHull"
mesh = obj.to_mesh()
props["points"] = ""
for v in mesh.vertices:
props["points"] += "" + out_point3( v.co ) + "|"
props["points"] = props["points"].rstrip("|")
if scale != Vector((1,1,1)):
props["scale"] = out_scale3( scale )
# remove mesh
print(" shape type: '" + str(shape) + "' from element name:'" + str(obj.name) + "'")
if obj.matrix_world.to_translation() != Vector((0,0,0)):
props["origin"] = out_point3(obj.matrix_world.to_translation())
qrot = obj.matrix_world.to_quaternion()
if qrot != Quaternion((1,0,0,0)):
props["rotate"] = out_quaternion(qrot)
props["mass"] = obj.scale.x * obj.scale.y * obj.scale.z * 100.0
if props["mass"] < 0.01:
props["mass"] = 0.01
return (shape, props)
def write_collision_shape(object, file, mainObjScale, offset):
if len(getChildren(object))==0:
# no phisical shape ...
return
string_offset = ""
for iii in range(offset):
string_offset += "\t"
file.write(string_offset + 'Physics:\n')
for subObj in getChildren(object):
print(" element='" + subObj.name + "' type '" + str(subObj.type) + "'")
if subObj.type != 'MESH' \
and subObj.type != 'EMPTY':
continue
(shape, props) = get_physics_shape(subObj, mainObjScale)
if shape=="":
print("error of shape detection type ...");
continue
file.write(string_offset + "\t" + shape + "\n" )
for (k,v) in props.items():
file.write(string_offset + "\t\t%s:%s\n" % (k, v) )
def name_compat(name):
if name is None:
return 'None'
else:
return name.replace(' ', '_')
def mesh_triangulate(me):
import bmesh
bm = bmesh.new()
bm.from_mesh(me)
bmesh.ops.triangulate(bm, faces=bm.faces)#, use_beauty=False)
bm.to_mesh(me)
bm.free()
def write_mtl(scene, file, filepath, path_mode, copy_set, mtl_dict):
from mathutils import Color
world = scene.world
#if world and world.ambient_color:
# world_amb = world.ambient_color
#else:
world_amb = Color((0.0, 0.0, 0.0))
source_dir = os.path.dirname(bpy.data.filepath)
dest_dir = os.path.dirname(filepath)
file.write('\n')
#file.write('\nMaterials:%i\n' % len(mtl_dict))
mtl_dict_values = list(mtl_dict.values())
mtl_dict_values.sort(key=lambda m: m[0])
# Write material/image combinations we have used.
# Using mtl_dict.values() directly gives un-predictable order.
for mtl_mat_name, mat, face_img in mtl_dict_values:
# Get the Blender data for the material and the image.
# Having an image named None will make a bug, dont do it:)
file.write('Materials:%s\n' % mtl_mat_name) # Define a new material: matname_imgname
if mat:
# convert from blenders spec to 0 - 1000 range.
if mat.specular_shader == 'WARDISO':
tspec = (0.4 - mat.specular_slope) / 0.0004
else:
tspec = (mat.specular_hardness - 1) * 1.9607843137254901
file.write('\tNs %.6f\n' % tspec)
del tspec
file.write('\tKa %.6f %.6f %.6f\n' % (mat.ambient * world_amb)[:]) # Ambient, uses mirror color,
file.write('\tKd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:]) # Diffuse
file.write('\tKs %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:]) # Specular
if hasattr(mat, "ior"):
file.write('\tNi %.6f\n' % mat.ior) # Refraction index
else:
file.write('\tNi %.6f\n' % 1.0)
file.write('\td %.6f\n' % mat.alpha) # Alpha (obj uses 'd' for dissolve)
# 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting.
if mat.use_shadeless:
file.write('\tillum 0\n') # ignore lighting
elif mat.specular_intensity == 0:
file.write('\tillum 1\n') # no specular.
else:
file.write('\tillum 2\n') # light normaly
else:
#write a dummy material here?
file.write('\tNs 0\n')
file.write('\tKa %.6f %.6f %.6f\n' % world_amb[:]) # Ambient, uses mirror color,
file.write('\tKd 0.8 0.8 0.8\n')
file.write('\tKs 0.8 0.8 0.8\n')
file.write('\td 1\n') # No alpha
file.write('\tillum 2\n') # light normaly
# Write images!
if face_img: # We have an image on the face!
filepath = face_img.filepath
if filepath: # may be '' for generated images
# write relative image path
filepath = bpy_extras.io_utils.path_reference(filepath,
source_dir,
dest_dir,
path_mode,
"",
copy_set,
face_img.library)
file.write('\tmap_Kd %s\n' % filepath) # Diffuse mapping image
del filepath
else:
# so we write the materials image.
face_img = None
if mat: # No face image. if we havea material search for MTex image.
image_map = {}
# backwards so topmost are highest priority
for mtex in reversed(mat.texture_slots):
if mtex and mtex.texture and mtex.texture.type == 'IMAGE':
image = mtex.texture.image
if image:
# texface overrides others
if( mtex.use_map_color_diffuse
and (face_img is None)
and (mtex.use_map_warp is False)
and (mtex.texture_coords != 'REFLECTION')
):
image_map["map_Kd"] = image
if mtex.use_map_ambient:
image_map["map_Ka"] = image
# this is the Spec intensity channel but Ks stands for specular Color
if mtex.use_map_color_spec: # specular color
image_map["map_Ks"] = image
if mtex.use_map_hardness: # specular hardness/glossiness
image_map["map_Ns"] = image
if mtex.use_map_alpha:
image_map["map_d"] = image
if mtex.use_map_translucency:
image_map["map_Tr"] = image
if mtex.use_map_normal and (mtex.texture.use_normal_map is True):
image_map["map_Bump"] = image
if mtex.use_map_normal and (mtex.texture.use_normal_map is False):
image_map["map_Disp"] = image
if mtex.use_map_color_diffuse and (mtex.texture_coords == 'REFLECTION'):
image_map["map_refl"] = image
if mtex.use_map_emit:
image_map["map_Ke"] = image
for key, image in image_map.items():
filepath = bpy_extras.io_utils.path_reference(image.filepath,
source_dir,
dest_dir,
path_mode,
"",
copy_set,
image.library)
file.write('\t%s %s\n' % (key, repr(filepath)[1:-1]))
def veckey3d(v):
return round(v.x, 6), round(v.y, 6), round(v.z, 6)
def veckey2d(v):
return round(v[0], 6), round(v[1], 6)
def write_mesh(scene, file, object, mtl_dict):
print("**************** '" + str(object.name) + "' *******************")
# Initialize totals, these are updated each object
totverts = 1
totuvco = 1
totno = 1
globalNormals = {}
face_vert_index = 1
# Used to reduce the usage of matname_texname materials, which can become annoying in case of
# repeated exports/imports, yet keeping unique mat names per keys!
# mtl_name: (material.name, image.name)
mtl_rev_dict = {}
if object.type != 'MESH':
print(object.name + 'is not a mesh type - ignoring type=' + object.type)
file.write('# can not export:"%s":type="%s"\n' % (object.name, str(object.type)))
return
#print("name:'%s'" % object.name)
#for plop in object.child:
# print(" child:'%s'" % plop.name)
# ignore dupli children
if object.parent and object.parent.instance_type in {'VERTS', 'FACES'}:
# XXX
print(object.name, 'is a dupli child - ignoring')
return
obs = []
if object.instance_type != 'NONE':
# XXX
print('******************** creating instance_type on', object.name)
"""
object.dupli_list_create(scene)
obs = [(dob.object, dob.matrix) for dob in object.dupli_list]
# XXX debug print
print(object.name, 'has', len(obs), 'dupli children')
"""
else:
obs = [(object, object.matrix_world)]
for ob, ob_mat in obs:
try:
# apply the mesh modifieur at the curent object:
me = ob.to_mesh()
except RuntimeError:
me = None
if me is None:
continue
me.transform(ob_mat)
#print("ploppp:" + str(ob_mat) )
# _must_ do this first since it re-allocs arrays
# triangulate all the mesh:
mesh_triangulate(me)
# calculated normals:
me.calc_normals()
# export UV mapping:
faceuv = len(me.uv_textures) > 0
if faceuv:
uv_texture = me.uv_textures.active.data[:]
uv_layer = me.uv_layers.active.data[:]
me_verts = me.vertices[:]
# Make our own list so it can be sorted to reduce context switching
face_index_pairs = [(face, index) for index, face in enumerate(me.polygons)]
# faces = [ f for f in me.tessfaces ]
edges = me.edges
if not (len(face_index_pairs) + len(edges) + len(me.vertices)): # Make sure there is somthing to write
# clean up
bpy.data.meshes.remove(me)
continue # dont bother with this mesh.
materials = me.materials[:]
material_names = [m.name if m else None for m in materials]
# avoid bad index errors
if not materials:
materials = [None]
material_names = [name_compat(None)]
# Sort by Material, then images
# so we dont over context switch in the obj file.
if faceuv:
face_index_pairs.sort(key=lambda a: (a[0].material_index, hash(uv_texture[a[1]].image), a[0].use_smooth))
elif len(materials) > 1:
face_index_pairs.sort(key=lambda a: (a[0].material_index, a[0].use_smooth))
else:
# no materials
face_index_pairs.sort(key=lambda a: a[0].use_smooth)
# Set the default mat to no material and no image.
contextMat = 0, 0 # Can never be this, so we will label a new material the first chance we get.
contextSmooth = None # Will either be true or false, set bad to force initialization switch.
# use:blen obs ??? what is this ....
name1 = ob.name
name2 = ob.data.name
if name1 == name2:
obnamestring = name_compat(name1)
else:
obnamestring = '%s_%s' % (name_compat(name1), name_compat(name2))
file.write('Mesh:%s\n' % obnamestring) # Write Object name
###########################################################
## Vert
###########################################################
file.write('\tVertex:%d\n\t\t' % len(me_verts))
for v in me_verts:
file.write('%.6f %.6f %.6f|' % v.co[:])
file.write('\n')
###########################################################
## UV
###########################################################
if faceuv:
file.write('\tUV-mapping:\n\t\t')
# in case removing some of these dont get defined.
uv = uvkey = uv_dict = f_index = uv_index = None
uv_face_mapping = [None] * len(face_index_pairs)
uv_dict = {} # could use a set() here
for f, f_index in face_index_pairs:
uv_ls = uv_face_mapping[f_index] = []
for uv_index, l_index in enumerate(f.loop_indices):
uv = uv_layer[l_index].uv
uvkey = veckey2d(uv)
try:
uv_k = uv_dict[uvkey]
except:
uv_k = uv_dict[uvkey] = len(uv_dict)
file.write('%.6f %.6f|' % uv[:])
uv_ls.append(uv_k)
uv_unique_count = len(uv_dict)
del uv, uvkey, uv_dict, f_index, uv_index, uv_ls, uv_k
# Only need uv_unique_count and uv_face_mapping
file.write('\n')
else:
print("does not use UV-MAPPING")
###########################################################
## NORMAL
###########################################################
if len(face_index_pairs) > 0:
if face_index_pairs[0][0].use_smooth:
localIsSmooth = 'vertex'
else:
localIsSmooth = 'face'
else:
localIsSmooth = 'face'
file.write('\tNormal(%s):%d\n\t\t' % (localIsSmooth, len(face_index_pairs)) )
for f, f_index in face_index_pairs:
if f.use_smooth:
for v_idx in f.vertices:
v = me_verts[v_idx]
noKey = veckey3d(v.normal)
if noKey not in globalNormals:
globalNormals[noKey] = totno
totno += 1
file.write('%.6f %.6f %.6f|' % noKey)
else:
# Hard, 1 normal from the face.
noKey = veckey3d(f.normal)
if noKey not in globalNormals:
globalNormals[noKey] = totno
totno += 1
file.write('%.6f %.6f %.6f|' % noKey)
file.write('\n')
if not faceuv:
f_image = None
###########################################################
## faces
###########################################################
file.write('\tFace:%d' % len(face_index_pairs))
for f, f_index in face_index_pairs:
f_smooth = f.use_smooth
f_mat = min(f.material_index, len(materials) - 1)
if faceuv:
tface = uv_texture[f_index]
f_image = tface.image
# MAKE KEY
if faceuv and f_image: # Object is always true.
key = material_names[f_mat], f_image.name
else:
key = material_names[f_mat], None # No image, use None instead.
# CHECK FOR CONTEXT SWITCH
if key == contextMat:
pass # Context already switched, dont do anything
else:
if key[0] is None and key[1] is None:
# inform the use of a material:
file.write("\n\t\t---:") # mat, image
else:
mat_data = mtl_dict.get(key)
if not mat_data:
# First add to global dict so we can export to mtl
# Then write mtl
# Make a new names from the mat and image name,
# converting any spaces to underscores with name_compat.
# If none image dont bother adding it to the name
# Try to avoid as much as possible adding texname (or other things)
# to the mtl name (see [#32102])...
mtl_name = "%s" % name_compat(key[0])
if mtl_rev_dict.get(mtl_name, None) not in {key, None}:
if key[1] is None:
tmp_ext = "_NONE"
else:
tmp_ext = "_%s" % name_compat(key[1])
i = 0
while mtl_rev_dict.get(mtl_name + tmp_ext, None) not in {key, None}:
i += 1
tmp_ext = "_%3d" % i
mtl_name += tmp_ext
mat_data = mtl_dict[key] = mtl_name, materials[f_mat], f_image
mtl_rev_dict[mtl_name] = key
# set the use of a material:
file.write("\n\t\t%s\n\t\t\t" % mat_data[0]) # can be mat_image or (null)
contextMat = key
f_v = [(vi, me_verts[v_idx]) for vi, v_idx in enumerate(f.vertices)]
if faceuv:
# export the normals:
if f_smooth: # Smoothed, use vertex normals
for vi, v in f_v:
file.write(" %d/%d/%d" %
(v.index + totverts-1,
totuvco + uv_face_mapping[f_index][vi]-1,
globalNormals[veckey3d(v.normal)]-1,
)) # vert, uv, normal
else: # No smoothing, face normals
no = globalNormals[veckey3d(f.normal)]
for vi, v in f_v:
file.write(" %d/%d/%d" %
(v.index + totverts-1,
totuvco + uv_face_mapping[f_index][vi]-1,
no-1,
)) # vert, uv, normal
face_vert_index += len(f_v)
else: # No UV's
# export the normals:
if f_smooth: # Smoothed, use vertex normals
for vi, v in f_v:
file.write(" %d/%d" % (
v.index + totverts-1,
globalNormals[veckey3d(v.normal)]-1,
))
else: # No smoothing, face normals
no = globalNormals[veckey3d(f.normal)]
for vi, v in f_v:
file.write(" %d/%d" % (v.index + totverts-1, no-1))
file.write('|')
file.write('\n')
# Write edges. ==> did not know what it is ...
#file.write('Faces:%d' % len(edges))
#for ed in edges:
# if ed.is_loose:
# file.write('%d %d\n' % (ed.vertices[0] + totverts, ed.vertices[1] + totverts))
# Make the indices global rather then per mesh
totverts += len(me_verts)
if faceuv:
totuvco += uv_unique_count
# clean up
bpy.data.meshes.remove(me)
if object.dupli_type != 'NONE':
object.dupli_list_clear()
#####################################################################
## Save collision shapes (for one object):
#####################################################################
for subObj in getChildren(object):
print(" child:'%s' check if start with : '%s'" % (subObj.name, EXPORT_COLLISION_NAME))
if subObj.name.lower().startswith(EXPORT_COLLISION_NAME):
print(" find physics:'%s'" % (subObj.name))
write_collision_shape(subObj, file, object.scale, 1)
"""
" @brief Basic write function. The context and options must be already set.
"""
def write_file(filepath,
objects,
scene,
EXPORT_PATH_MODE='AUTO',
EXPORT_BINARY_MODE=False,
EXPORT_COLLISION_NAME=""
):
print('EMF Export path: %r' % filepath)
time1 = time.time()
mtlfilepath = os.path.splitext(filepath)[0] + ".mtl"
file = open(filepath, "w", encoding="utf8", newline="\n")
# Write Header
file.write('EMF(STRING)\n') # if binary:file.write('EMF(BINARY)\n')
file.write('# Blender v%s EMF File: %r\n' % (bpy.app.version_string, os.path.basename(bpy.data.filepath)))
# A Dict of Materials
# (material.name, image.name):matname_imagename # matname_imagename has gaps removed.
mtl_dict = {}
copy_set = set()
"""
nb_total_mesh = 0
nb_total_physic = 0
for ob_main in objects:
print("**************** '" + str(ob_main.name) + "' *******************")
if ob_main.type == 'EMPTY':
for sub_obj in getChildren(ob_main):
print(" child:'" + str(sub_obj.name) + "' type=" + sub_obj.type)
if sub_obj.type == 'MESH':
nb_total_mesh += 1
elif sub_obj.type == 'EMPTY' \
and sub_obj.name.lower().startswith("physic"):
nb_total_physic += 1
for sub_obj_2 in getChildren(sub_obj):
print(" child:'" + str(sub_obj_2.name) + "' type=" + sub_obj_2.type)
for sub_obj_3 in getChildren(sub_obj_2):
print(" child:'" + str(sub_obj_3.name) + "' type=" + sub_obj_3.type)
if ob_main.type == 'MESH':
nb_total_mesh += 1
print("nb_total_mesh: " + str(nb_total_mesh))
print("nb_total_physic: " + str(nb_total_physic))
"""
# Get all meshes
for ob_main in objects:
if ob_main.type == 'MESH':
write_mesh(scene, file, ob_main, mtl_dict)
elif ob_main.type == 'EMPTY':
for sub_obj in getChildren(ob_main):
print(" child:'" + str(sub_obj.name) + "' type=" + sub_obj.type)
if sub_obj.type == 'MESH':
write_mesh(scene, file, sub_obj, mtl_dict)
elif sub_obj.type == 'EMPTY' \
and sub_obj.name.lower().startswith("physic"):
print(" child:'" + str(sub_obj.name) + "' type=" + sub_obj.type)
#####################################################################
## Save collision shapes (for one all):
#####################################################################
write_collision_shape(sub_obj, file, sub_obj.scale, 0)
else:
print(" child:'" + str(sub_obj.name) + "' type=" + sub_obj.type + " not parsed ...")
#####################################################################
## Now we have all our materials, save them in the material section
#####################################################################
write_mtl(scene, file, mtlfilepath, EXPORT_PATH_MODE, copy_set, mtl_dict)
#####################################################################
## End of the file generation:
#####################################################################
file.close()
# copy all collected files.
bpy_extras.io_utils.path_reference_copy(copy_set)
print("EMF Export time: %.2f" % (time.time() - time1))
"""
" @brief generate the requested object file ... with his material inside and ...
"
"""
def _write(context,
filepath,
EXPORT_SEL_ONLY,
EXPORT_PATH_MODE,
EXPORT_BINARY_MODE,
EXPORT_COLLISION_NAME,
):
#
base_name, ext = os.path.splitext(filepath)
# create the output name:
context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension
# get the curent scene:
scene = context.scene
# Exit edit mode before exporting, so current object states are exported properly.
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT')
# get the curent frame selected:
frame = scene.frame_current
# Loop through all frames in the scene and export.
scene.frame_set(frame, subframe=0.0)
# get only the object that are selected or all...
if EXPORT_SEL_ONLY:
objects = context.selected_objects
else:
objects = scene.objects
full_path = ''.join(context_name)
write_file(full_path,
objects,
scene,
EXPORT_PATH_MODE,
EXPORT_BINARY_MODE,
EXPORT_COLLISION_NAME,
)
"""
" @brief Save the current element in the file requested.
"
"""
def save(operator,
context,
filepath="",
use_selection=True,
use_binary=False,
collision_object_name="",
path_mode='AUTO'
):
_write(context,
filepath,
EXPORT_SEL_ONLY=use_selection,
EXPORT_PATH_MODE=path_mode,
EXPORT_BINARY_MODE=use_binary,
EXPORT_COLLISION_NAME=collision_object_name,
)
return {'FINISHED'}

7
samples/.checkstyle Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<fileset name="all" enabled="true" check-config-name="Ewol" local="false">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
</fileset-config>

21
samples/.classpath Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-ege">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-etk">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>

1
samples/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bin/

17
samples/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>atriasoft-ege-samples</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.ui.text.custom_code_templates=

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

View File

Before

Width:  |  Height:  |  Size: 517 KiB

After

Width:  |  Height:  |  Size: 517 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View File

Before

Width:  |  Height:  |  Size: 577 KiB

After

Width:  |  Height:  |  Size: 577 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 296 B

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 426 KiB

After

Width:  |  Height:  |  Size: 426 KiB

View File

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 991 KiB

After

Width:  |  Height:  |  Size: 991 KiB

View File

Before

Width:  |  Height:  |  Size: 938 KiB

After

Width:  |  Height:  |  Size: 938 KiB

View File

Before

Width:  |  Height:  |  Size: 1003 KiB

After

Width:  |  Height:  |  Size: 1003 KiB

View File

Before

Width:  |  Height:  |  Size: 342 KiB

After

Width:  |  Height:  |  Size: 342 KiB

View File

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 193 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,327 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<asset>
<contributor>
<author>Blender User</author>
<authoring_tool>Blender 2.92.0 commit date:2021-02-24, commit time:16:25, hash:02948a2cab44</authoring_tool>
</contributor>
<created>2021-04-15T23:57:56</created>
<modified>2021-04-15T23:57:56</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_cameras>
<camera id="Camera-camera" name="Camera">
<optics>
<technique_common>
<perspective>
<xfov sid="xfov">39.59775</xfov>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">100</zfar>
</perspective>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<shiftx sid="shiftx" type="float">0</shiftx>
<shifty sid="shifty" type="float">0</shifty>
<dof_distance sid="dof_distance" type="float">10</dof_distance>
</technique>
</extra>
</camera>
</library_cameras>
<library_lights>
<light id="Light-light" name="Light">
<technique_common>
<point>
<color sid="color">1000 1000 1000</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.00111109</quadratic_attenuation>
</point>
</technique_common>
<extra>
<technique profile="blender">
<type sid="type" type="int">0</type>
<flag sid="flag" type="int">0</flag>
<mode sid="mode" type="int">1</mode>
<gamma sid="blender_gamma" type="float">1</gamma>
<red sid="red" type="float">1</red>
<green sid="green" type="float">1</green>
<blue sid="blue" type="float">1</blue>
<shadow_r sid="blender_shadow_r" type="float">0</shadow_r>
<shadow_g sid="blender_shadow_g" type="float">0</shadow_g>
<shadow_b sid="blender_shadow_b" type="float">0</shadow_b>
<energy sid="blender_energy" type="float">1000</energy>
<dist sid="blender_dist" type="float">29.99998</dist>
<spotsize sid="spotsize" type="float">75</spotsize>
<spotblend sid="spotblend" type="float">0.15</spotblend>
<att1 sid="att1" type="float">0</att1>
<att2 sid="att2" type="float">1</att2>
<falloff_type sid="falloff_type" type="int">2</falloff_type>
<clipsta sid="clipsta" type="float">0.04999995</clipsta>
<clipend sid="clipend" type="float">30.002</clipend>
<bias sid="bias" type="float">1</bias>
<soft sid="soft" type="float">3</soft>
<bufsize sid="bufsize" type="int">2880</bufsize>
<samp sid="samp" type="int">3</samp>
<buffers sid="buffers" type="int">1</buffers>
<area_shape sid="area_shape" type="int">1</area_shape>
<area_size sid="area_size" type="float">0.1</area_size>
<area_sizey sid="area_sizey" type="float">0.1</area_sizey>
<area_sizez sid="area_sizez" type="float">1</area_sizez>
</technique>
</extra>
</light>
</library_lights>
<library_effects>
<effect id="base_tower-effect">
<profile_COMMON>
<technique sid="common">
<lambert>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<diffuse>
<color sid="diffuse">0.001353697 0.8000001 0.05331983 1</color>
</diffuse>
<index_of_refraction>
<float sid="ior">1.45</float>
</index_of_refraction>
</lambert>
</technique>
</profile_COMMON>
</effect>
<effect id="Material-effect">
<profile_COMMON>
<technique sid="common">
<lambert>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<diffuse>
<color sid="diffuse">0.8000001 0 0.008711318 1</color>
</diffuse>
<index_of_refraction>
<float sid="ior">1.45</float>
</index_of_refraction>
</lambert>
</technique>
</profile_COMMON>
</effect>
<effect id="Material_001-effect">
<profile_COMMON>
<technique sid="common">
<lambert>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<diffuse>
<color sid="diffuse">0.1136548 0.510074 0.8000001 1</color>
</diffuse>
<index_of_refraction>
<float sid="ior">1.45</float>
</index_of_refraction>
</lambert>
</technique>
</profile_COMMON>
</effect>
<effect id="Material_002-effect">
<profile_COMMON>
<technique sid="common">
<lambert>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<diffuse>
<color sid="diffuse">0.0146695 0.0146695 0.0146695 1</color>
</diffuse>
<index_of_refraction>
<float sid="ior">1.45</float>
</index_of_refraction>
</lambert>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_images/>
<library_materials>
<material id="base_tower-material" name="base tower">
<instance_effect url="#base_tower-effect"/>
</material>
<material id="Material-material" name="Material">
<instance_effect url="#Material-effect"/>
</material>
<material id="Material_001-material" name="Material.001">
<instance_effect url="#Material_001-effect"/>
</material>
<material id="Material_002-material" name="Material.002">
<instance_effect url="#Material_002-effect"/>
</material>
</library_materials>
<library_geometries>
<geometry id="Cube-mesh" name="Cube">
<mesh>
<source id="Cube-mesh-positions">
<float_array id="Cube-mesh-positions-array" count="204">1 1 1 1 1 -0.4590548 1 -1 1 1 -1 -0.4590548 -1 1 1 -1 1 -0.4590548 -1 -1 1 -1 -1 -0.4590548 0.5190913 0.5190913 2.020207 0.5190913 -0.5190913 2.020207 -0.5190913 0.5190913 2.020207 -0.5190913 -0.5190913 2.020207 1.267435 0.5190913 2.311062 1.267435 -0.5190913 2.311062 -0.5190913 0.5190913 2.311062 -0.5190913 -0.5190913 2.311062 1.267435 0.5190913 3.133908 1.267435 -0.5190913 3.133908 -0.5190913 0.5190913 3.133908 -0.5190913 -0.5190913 3.133908 -1.007701 0.1338565 2.616392 -1.007701 -0.1338565 2.616392 -1.007701 0.1338565 2.828578 -1.007701 -0.1338565 2.828578 -3.394721 0.1081237 2.636788 -3.394721 -0.1081237 2.636788 -3.394721 0.1081237 2.808182 -3.394721 -0.1081237 2.808182 -3.394721 0.1483429 2.604911 -3.394721 -0.1483429 2.604911 -3.394721 0.1483429 2.840059 -3.394721 -0.1483429 2.840059 -3.865651 0.1483429 2.604911 -3.865651 -0.1483429 2.604911 -3.865651 0.1483429 2.840059 -3.865651 -0.1483429 2.840059 0.4686203 0.2274325 2.087707 0.4686203 -0.2274325 2.087707 -0.2274325 0.2274325 2.087707 -0.2274325 -0.2274325 2.087707 0.6712364 0.2274325 2.408801 0.6712364 -0.2274325 2.408801 0.2163712 0.2274325 2.408801 0.2163712 -0.2274325 2.408801 1.304951 1.304951 -0.6408936 1.304951 -1.304951 -0.6408936 -1.304951 1.304951 -0.6408936 -1.304951 -1.304951 -0.6408936 1.304951 1.304951 -0.9694133 1.304951 -1.304951 -0.9694133 -1.304951 1.304951 -0.9694133 -1.304951 -1.304951 -0.9694133 1.644974 0.3190181 2.469636 1.644974 -0.3190181 2.469636 1.644974 0.3190181 2.975334 1.644974 -0.3190181 2.975334 1.469387 0.1548147 2.599781 1.469387 -0.1548147 2.599781 1.469387 0.1548147 2.845189 1.469387 -0.1548147 2.845189 -3.865651 0.08153259 2.657864 -3.865651 -0.08153259 2.657864 -3.865651 0.08153259 2.787106 -3.865651 -0.08153259 2.787106 0.3018358 0.08153259 2.657864 0.3018358 -0.08153259 2.657864 0.3018358 0.08153259 2.787106 0.3018358 -0.08153259 2.787106</float_array>
<technique_common>
<accessor source="#Cube-mesh-positions-array" count="68" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Cube-mesh-normals">
<float_array id="Cube-mesh-normals-array" count="228">0 0.9045414 0.4263859 0 -1 0 -1 0 0 0 -0.5121497 0.8588963 1 0 0 0 1 0 0 0 -1 0 -0.9045414 0.4263859 -0.9045414 0 0.4263859 0.9045414 0 0.4263859 0 -0.225474 0.9742492 0 1 0 -0.225474 0 0.9742492 0 0 1 0.4682527 0.8835947 0 -0.6191396 0.785281 0 -0.01077967 -0.999942 0 -0.5299356 0 0.8480379 -0.6191396 -0.785281 0 -0.5299357 0 -0.8480378 -0.008543968 0 0.9999635 -0.01077961 0.999942 0 -0.008544087 0 -0.9999635 1 4.32336e-6 0 1 -4.32335e-6 0 -1 -5.69097e-6 0 0 0.2254741 0.9742492 0.8008747 0 0.5988321 0.8457028 0 -0.5336541 0 -1 0 -0.5861729 0 0.8101861 -0.5121498 0 0.8588962 0.5121498 0 0.8588962 0 0.5121497 0.8588963 0.5954643 0 0.8033819 0.3872494 0 0.921975 0.4682528 -0.8835946 0 0.3872498 0 -0.921975 0.6830338 0.7303869 0 0.5954651 0 -0.8033812 0.6830338 -0.7303869 0 -1 5.69097e-6 0 0 0.9045414 0.4263858 0 -0.5121495 0.8588964 0 -0.9045414 0.4263858 -0.9045414 0 0.4263858 0.9045414 0 0.4263858 0 -0.2254741 0.9742492 0 1 0 -0.2254737 0 0.9742493 0.4682531 0.8835944 0 -0.6191402 0.7852805 0 -0.01077961 -0.9999419 0 -0.529936 0 0.8480377 -0.6191402 -0.7852805 0 -0.5299366 0 -0.8480374 -0.008544027 0 0.9999636 -0.01077967 0.9999419 0 -0.008543848 0 -0.9999636 1 -1.26048e-5 0 1 1.26048e-5 0 0 0.225474 0.9742492 0.8008742 0 0.5988326 0.845703 0 -0.5336538 0 -1 0 -0.5861732 0 0.8101858 -0.5121495 0 0.8588964 0.5121495 0 0.8588964 0 0.5121495 0.8588964 0.5954657 0 0.8033809 0.3872495 0 0.921975 0.4682529 -0.8835946 0 0.3872503 0 -0.9219747 0.6830333 0.7303873 0 0.5954657 0 -0.8033809 0.6830333 -0.7303873 0</float_array>
<technique_common>
<accessor source="#Cube-mesh-normals-array" count="76" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Cube-mesh-map-0">
<float_array id="Cube-mesh-map-0-array" count="768">0.625 0.25 0.625 0.5 0.625 0.5 0.625 0.75 0.375 1 0.375 0.75 0.625 0 0.375 0.25 0.375 0 0.375 1 0.375 0.75 0.375 0.75 0.625 0.5 0.375 0.75 0.375 0.5 0.625 0.25 0.375 0.5 0.375 0.25 0.625 0 0.625 0.5 0.625 0.75 0.625 0.75 0.625 1 0.625 1 0.625 0 0.625 0.25 0.625 0.25 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.25 0.625 0.5 0.625 0.5 0.625 0.75 0.625 1 0.625 1 0.625 0.5 0.625 0.25 0.625 0.5 0.625 0 0.625 0.25 0.625 0.25 0.875 0.5 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.75 0.625 1 0.625 1 0.625 1 0.625 1 0.625 1 0.875 0.5 0.875 0.75 0.875 0.75 0.625 1 0.625 1 0.625 1 0.625 0 0.625 0.25 0.625 0.25 0.875 0.5 0.875 0.75 0.875 0.75 0.875 0.5 0.875 0.75 0.875 0.75 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0 0.625 0.25 0.625 0.25 0.625 1 0.625 1 0.625 1 0.625 1 0.625 1 0.625 1 0.625 0 0.625 0.25 0.625 0.25 0.625 1 0.625 1 0.625 1 0.875 0.5 0.875 0.75 0.875 0.75 0.625 0.5 0.625 0.25 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0 0.625 0.75 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 1 0.625 1 0.625 0 0.625 0.25 0.625 0.25 0.375 0.75 0.375 0.5 0.375 0.5 0.375 0.25 0.375 0 0.375 0 0.375 0.75 0.375 0.5 0.375 0.5 0.375 0.5 0.375 0.25 0.375 0.25 0.375 0.5 0.125 0.75 0.125 0.5 0.375 0.5 0.375 0.25 0.375 0.25 0.375 1 0.375 0.75 0.375 0.75 0.375 0.25 0.375 0 0.375 0 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0.25 0.875 0.5 0.875 0.75 0.875 0.75 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0 0.625 0.25 0.625 0.25 0.625 0 0.625 0.25 0.625 0.25 0.625 0 0.625 0.25 0.625 0.25 0.625 1 0.625 1 0.625 1 0.875 0.5 0.875 0.75 0.875 0.75 0.625 0.25 0.625 0.25 0.625 0.5 0.625 0.75 0.625 1 0.375 1 0.625 0 0.625 0.25 0.375 0.25 0.375 1 0.375 1 0.375 0.75 0.625 0.5 0.625 0.75 0.375 0.75 0.625 0.25 0.625 0.5 0.375 0.5 0.625 0 0.625 0.25 0.625 0.5 0.625 0.75 0.625 0.75 0.625 1 0.625 0 0.625 0 0.625 0.25 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.25 0.625 0.25 0.625 0.5 0.625 0.75 0.625 0.75 0.625 1 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.875 0.5 0.875 0.75 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.75 0.625 0.75 0.625 1 0.625 1 0.625 1 0.625 1 0.875 0.5 0.875 0.5 0.875 0.75 0.625 1 0.625 1 0.625 1 0.625 0 0.625 0 0.625 0.25 0.875 0.5 0.875 0.5 0.875 0.75 0.875 0.5 0.875 0.5 0.875 0.75 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.625 1 0.625 1 0.625 1 0.625 1 0.625 1 0.625 1 0.625 0 0.625 0 0.625 0.25 0.625 1 0.625 1 0.625 1 0.875 0.5 0.875 0.5 0.875 0.75 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.5 0.625 0.25 0.625 0 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 1 0.625 0 0.625 0 0.625 0.25 0.375 0.75 0.375 0.75 0.375 0.5 0.375 0.25 0.375 0.25 0.375 0 0.375 0.75 0.375 0.75 0.375 0.5 0.375 0.5 0.375 0.5 0.375 0.25 0.375 0.5 0.375 0.75 0.125 0.75 0.375 0.5 0.375 0.5 0.375 0.25 0.375 1 0.375 1 0.375 0.75 0.375 0.25 0.375 0.25 0.375 0 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.75 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.5 0.625 0.25 0.625 0.25 0.625 0.25 0.875 0.5 0.875 0.5 0.875 0.75 0.625 0.25 0.625 0.25 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.625 0 0.625 0 0.625 0.25 0.625 1 0.625 1 0.625 1 0.875 0.5 0.875 0.5 0.875 0.75</float_array>
<technique_common>
<accessor source="#Cube-mesh-map-0-array" count="384" stride="2">
<param name="S" type="float"/>
<param name="T" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Cube-mesh-vertices">
<input semantic="POSITION" source="#Cube-mesh-positions"/>
</vertices>
<triangles material="base_tower-material" count="78">
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
<input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
<p>15 6 18 12 6 19 13 6 20 14 5 30 16 5 31 12 5 32 9 10 33 39 10 34 11 10 35 36 11 36 42 11 37 40 11 38 11 12 39 38 12 40 10 12 41 18 13 42 17 13 43 16 13 44 14 15 48 22 15 49 18 15 50 13 1 51 19 1 52 15 1 53 18 17 57 23 17 58 19 17 59 19 18 60 21 18 61 15 18 62 15 19 63 20 19 64 14 19 65 26 4 66 31 4 67 27 4 68 28 5 78 34 5 79 30 5 80 24 23 81 30 23 82 26 23 83 25 4 84 28 4 85 24 4 86 27 24 87 29 24 88 25 24 89 35 25 90 61 25 91 33 25 92 29 6 93 32 6 94 28 6 95 31 1 96 33 1 97 29 1 98 30 13 99 35 13 100 31 13 101 8 26 102 38 26 103 36 26 104 8 27 105 37 27 106 9 27 107 40 13 108 43 13 109 41 13 110 36 28 111 41 28 112 37 28 113 37 29 114 43 29 115 39 29 116 39 30 117 42 30 118 38 30 119 52 34 144 57 34 145 53 34 146 56 4 156 59 4 157 57 4 158 53 38 159 59 38 160 55 38 161 55 39 162 58 39 163 54 39 164 54 40 165 56 40 166 52 40 167 60 1 168 66 1 169 62 1 170 34 2 171 63 2 172 35 2 173 32 41 174 62 41 175 34 41 176 33 2 177 60 2 178 32 2 179 65 2 180 66 2 181 64 2 182 61 13 183 64 13 184 60 13 185 63 5 186 65 5 187 61 5 188 62 6 189 67 6 190 63 6 191 15 6 210 14 6 211 12 6 212 14 5 222 18 5 223 16 5 224 9 47 225 37 47 226 39 47 227 36 48 228 38 48 229 42 48 230 11 49 231 39 49 232 38 49 233 18 13 234 19 13 235 17 13 236 14 51 240 20 51 241 22 51 242 13 1 243 17 1 244 19 1 245 18 53 249 22 53 250 23 53 251 19 54 252 23 54 253 21 54 254 15 55 255 21 55 256 20 55 257 26 4 258 30 4 259 31 4 260 28 5 270 32 5 271 34 5 272 24 59 273 28 59 274 30 59 275 25 4 276 29 4 277 28 4 278 27 60 279 31 60 280 29 60 281 35 2 282 63 2 283 61 2 284 29 6 285 33 6 286 32 6 287 31 1 288 35 1 289 33 1 290 30 13 291 34 13 292 35 13 293 8 61 294 10 61 295 38 61 296 8 62 297 36 62 298 37 62 299 40 13 300 42 13 301 43 13 302 36 63 303 40 63 304 41 63 305 37 64 306 41 64 307 43 64 308 39 65 309 43 65 310 42 65 311 52 69 336 56 69 337 57 69 338 56 4 348 58 4 349 59 4 350 53 73 351 57 73 352 59 73 353 55 74 354 59 74 355 58 74 356 54 75 357 58 75 358 56 75 359 60 1 360 64 1 361 66 1 362 34 2 363 62 2 364 63 2 365 32 2 366 60 2 367 62 2 368 33 2 369 61 2 370 60 2 371 65 2 372 67 2 373 66 2 374 61 13 375 65 13 376 64 13 377 63 5 378 67 5 379 65 5 380 62 6 381 66 6 382 67 6 383</p>
</triangles>
<triangles material="Material-material" count="16">
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
<input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
<p>16 14 45 52 14 46 12 14 47 23 16 54 25 16 55 21 16 56 22 20 69 27 20 70 23 20 71 20 21 72 26 21 73 22 21 74 21 22 75 24 22 76 20 22 77 17 35 147 54 35 148 16 35 149 13 36 150 55 36 151 17 36 152 12 37 153 53 37 154 13 37 155 16 50 237 54 50 238 52 50 239 23 52 246 27 52 247 25 52 248 22 56 261 26 56 262 27 56 263 20 57 264 24 57 265 26 57 266 21 58 267 25 58 268 24 58 269 17 70 339 55 70 340 54 70 341 13 71 342 53 71 343 55 71 344 12 72 345 52 72 346 53 72 347</p>
</triangles>
<triangles material="Material_001-material" count="16">
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
<input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
<p>4 0 0 8 0 1 0 0 2 2 1 3 7 1 4 3 1 5 6 2 6 5 2 7 7 2 8 0 4 12 3 4 13 1 4 14 4 5 15 1 5 16 5 5 17 2 7 21 11 7 22 6 7 23 6 8 24 10 8 25 4 8 26 0 9 27 9 9 28 2 9 29 4 42 192 10 42 193 8 42 194 2 1 195 6 1 196 7 1 197 6 2 198 4 2 199 5 2 200 0 4 204 2 4 205 3 4 206 4 5 207 0 5 208 1 5 209 2 44 213 9 44 214 11 44 215 6 45 216 11 45 217 10 45 218 0 46 219 8 46 220 9 46 221</p>
</triangles>
<triangles material="Material_002-material" count="18">
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
<input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
<p>7 3 9 45 3 10 3 3 11 45 4 120 48 4 121 44 4 122 5 31 123 47 31 124 7 31 125 3 32 126 44 32 127 1 32 128 1 33 129 46 33 130 5 33 131 48 6 132 51 6 133 50 6 134 44 5 135 50 5 136 46 5 137 47 1 138 49 1 139 45 1 140 46 2 141 51 2 142 47 2 143 7 43 201 47 43 202 45 43 203 45 4 312 49 4 313 48 4 314 5 66 315 46 66 316 47 66 317 3 67 318 45 67 319 44 67 320 1 68 321 44 68 322 46 68 323 48 6 324 49 6 325 51 6 326 44 5 327 48 5 328 50 5 329 47 1 330 51 1 331 49 1 332 46 2 333 50 2 334 51 2 335</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_controllers>
<controller id="Armature_Cube-skin" name="Armature">
<skin source="#Cube-mesh">
<bind_shape_matrix>0.2627871 6.71843e-9 -0.05000365 -0.04638017 -6.71843e-9 0.2675021 6.33515e-10 -0.0201487 0.05000365 6.33515e-10 0.2627871 0.2520798 0 0 0 1</bind_shape_matrix>
<source id="Armature_Cube-skin-joints">
<Name_array id="Armature_Cube-skin-joints-array" count="2">Base canon</Name_array>
<technique_common>
<accessor source="#Armature_Cube-skin-joints-array" count="2" stride="1">
<param name="JOINT" type="name"/>
</accessor>
</technique_common>
</source>
<source id="Armature_Cube-skin-bind_poses">
<float_array id="Armature_Cube-skin-bind_poses-array" count="32">0.2627871 0 -0.05000364 0.002031147 0.05000364 0 0.2627871 -0.002338945 0 -0.2675021 0 -2.28e-4 0 0 0 1 3.33654e-4 0 0.267502 -0.9852814 -0.267502 0 3.33625e-4 0.1841412 0 -0.2675022 0 -2.2814e-4 0 0 0 1</float_array>
<technique_common>
<accessor source="#Armature_Cube-skin-bind_poses-array" count="2" stride="16">
<param name="TRANSFORM" type="float4x4"/>
</accessor>
</technique_common>
</source>
<source id="Armature_Cube-skin-weights">
<float_array id="Armature_Cube-skin-weights-array" count="68">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</float_array>
<technique_common>
<accessor source="#Armature_Cube-skin-weights-array" count="68" stride="1">
<param name="WEIGHT" type="float"/>
</accessor>
</technique_common>
</source>
<joints>
<input semantic="JOINT" source="#Armature_Cube-skin-joints"/>
<input semantic="INV_BIND_MATRIX" source="#Armature_Cube-skin-bind_poses"/>
</joints>
<vertex_weights count="68">
<input semantic="JOINT" source="#Armature_Cube-skin-joints" offset="0"/>
<input semantic="WEIGHT" source="#Armature_Cube-skin-weights" offset="1"/>
<vcount>1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 </vcount>
<v>0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 1 63 1 64 1 65 1 66 1 67</v>
</vertex_weights>
</skin>
</controller>
</library_controllers>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Armature" name="Armature" type="NODE">
<matrix sid="transform">3.672395 -9.38887e-8 0.6987906 -0.005824752 9.38887e-8 3.738287 8.85324e-9 0.07532164 -0.6987906 8.85324e-9 3.672395 0.01000908 0 0 0 1</matrix>
<node id="Armature_Base" name="Base" sid="Base" type="JOINT">
<matrix sid="transform">1 0 0 -5.1177e-10 0 0 -1 -0.0203767 0 1 0 -4.82573e-11 0 0 0 1</matrix>
<node id="Armature_canon" name="canon" sid="canon" type="JOINT">
<matrix sid="transform">-0.1857027 -0.9826061 -5.18209e-8 0 0.9826061 -0.1857026 1.38398e-7 1 -1.45614e-7 -2.52188e-8 1 0 0 0 0 1</matrix>
<extra>
<technique profile="blender">
<connect sid="connect" type="bool">1</connect>
<layer sid="layer" type="string">0</layer>
<roll sid="roll" type="float">-1.757583</roll>
<tip_x sid="tip_x" type="float">-1.161196</tip_x>
<tip_y sid="tip_y" type="float">0</tip_y>
<tip_z sid="tip_z" type="float">-0.2194542</tip_z>
</technique>
</extra>
</node>
<extra>
<technique profile="blender">
<layer sid="layer" type="string">0</layer>
</technique>
</extra>
</node>
<node id="Cube" name="Cube" type="NODE">
<matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
<instance_controller url="#Armature_Cube-skin">
<skeleton>#Armature_Base</skeleton>
<bind_material>
<technique_common>
<instance_material symbol="base_tower-material" target="#base_tower-material">
<bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
<instance_material symbol="Material-material" target="#Material-material">
<bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
<instance_material symbol="Material_001-material" target="#Material_001-material">
<bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
<instance_material symbol="Material_002-material" target="#Material_002-material">
<bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
</instance_controller>
</node>
</node>
<node id="Camera" name="Camera" type="NODE">
<matrix sid="transform">0.6859207 -0.3240135 0.6515582 7.358891 0.7276763 0.3054208 -0.6141704 -6.925791 0 0.8953956 0.4452714 4.958309 0 0 0 1</matrix>
<instance_camera url="#Camera-camera"/>
</node>
<node id="Light" name="Light" type="NODE">
<matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
<instance_light url="#Light-light"/>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#Scene"/>
</scene>
</COLLADA>

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,17 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
in vec2 io_textureCoords;
uniform sampler2D in_textureBase;
// output:
out vec4 out_Color;
void main(void) {
out_Color = texture(in_textureBase, io_textureCoords);
}

View File

@ -0,0 +1,21 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
// Input:
in vec3 in_position;
in vec2 in_textureCoords;
uniform mat4 in_matrixTransformation;
uniform mat4 in_matrixProjection;
uniform mat4 in_matrixView;
// output:
out vec2 io_textureCoords;
void main(void) {
gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * vec4(in_position, 1.0);
io_textureCoords = in_textureCoords;
}

View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Some files were not shown because too many files have changed in this diff Show More