Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cc5e4f1ee9 | ||
2f8051b97e | |||
0baab98804 | |||
b2c0eb7da6 | |||
f0eb83909f | |||
e179925a5f | |||
f6bb4f812a | |||
01069fa913 | |||
824641ce84 | |||
9ece075f62 | |||
3068e57245 | |||
7628561fb6 | |||
26f130ffd5 | |||
66bee2e43b | |||
f0c86f20de | |||
8d2e6305da | |||
4d73d8ac48 | |||
976afae490 | |||
13198ca95d | |||
1ecc20a08c | |||
4b24223561 | |||
39ca2f7624 | |||
0713227bfd | |||
ea6001ee1a | |||
552e1d560a | |||
7bbd3a4254 | |||
4e0fa632c8 | |||
822d0357da | |||
32236a2c14 | |||
5655d3e12b | |||
151aba4a58 |
@ -1,7 +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">
|
||||
<fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
||||
|
56
.classpath
@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="**/*.java__|**/__*.java" kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry including="**/*.java" kind="src" output="out/eclipse/classes-test" path="test/src">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<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="/atriasoft-gale">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<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>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="out/eclipse/classes"/>
|
||||
</classpath>
|
14
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
|
||||
/__pycache__/
|
||||
/bin/
|
||||
/Operator/
|
||||
/DrawerProperties/
|
||||
@ -15,3 +17,15 @@ build.number
|
||||
/.settings/
|
||||
/junit/
|
||||
/target/
|
||||
|
||||
*.blend1
|
||||
*.blend2
|
||||
*.blend3
|
||||
*.blend4
|
||||
*.blend5
|
||||
|
||||
*.pyc
|
||||
|
||||
__pycache__
|
||||
*.log
|
||||
|
||||
|
18
.project
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>atriasoft-ege</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>atriasoft-ege</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
44
README.md
@ -1,8 +1,44 @@
|
||||
Atria-soft ege
|
||||
==============
|
||||
Atria-soft ege (JAVA)
|
||||
=====================
|
||||
|
||||
[MPL-2] Mozilla public licence (V 2.0)
|
||||
`Ege` (Ewol Game Engine) is a FREE software.
|
||||
|
||||
|
||||
Game engine.
|
||||
Install blender exporter emf file
|
||||
=================================
|
||||
|
||||
get blender version
|
||||
|
||||
blender --version | grep "Blender "
|
||||
|
||||
create user addon directory: (replace 2.xx with the blender version)
|
||||
|
||||
mkdir -p ~/.config/blender/2.xx/scripts/addons/
|
||||
ln -s $(pwd)/blender/io_scene_emf ~/.config/blender/2.xx/scripts/addons/
|
||||
|
||||
- Launch Blender
|
||||
- File -> User Preferences
|
||||
- Select "Addons" tab
|
||||
- Enable "Import-export: Ewol Mesh file format emf"
|
||||
|
||||
Some error classile with awesome and blender
|
||||
============================================
|
||||
|
||||
- file -> user preferences -> system -> Windows draw methode: triple bufferings
|
||||
|
||||
|
||||
License (MPL v2.0)
|
||||
=====================
|
||||
Copyright ege Edouard DUPIN
|
||||
|
||||
Licensed under the Mozilla Public License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.mozilla.org/MPL/2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
@ -84,7 +84,7 @@ class ExportEMF(bpy.types.Operator, ExportHelper):
|
||||
use_selection = BoolProperty(
|
||||
name="Selection Only",
|
||||
description="Export selected objects only",
|
||||
default=True,
|
||||
default=False,
|
||||
)
|
||||
# generate binary file
|
||||
use_binary = BoolProperty(
|
||||
@ -125,7 +125,7 @@ class ExportEMF(bpy.types.Operator, ExportHelper):
|
||||
|
||||
global_matrix[0][0] = \
|
||||
global_matrix[1][1] = \
|
||||
global_matrix[2][2] = self.global_scale
|
||||
global_matrix[2][2] = 1.0 #self.global_scale
|
||||
|
||||
return export_emf.save(self, context, **keywords)
|
||||
|
||||
|
@ -1,9 +1,24 @@
|
||||
import bpy
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/workspace-game/atriasoft/ege/blender/io_scene_emf/../../samples/resources/emf/tree1.blend")
|
||||
|
||||
bpy.ops.export_scene.emf(filepath="/home/heero/dev/workspace-game/atriasoft/ege/blender/io_scene_emf/../../samples/resources/emf/tree1.emf")
|
||||
#bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/workspace-game/atriasoft/ege/blender/io_scene_emf/../../samples/resources/emf/tree1.blend")
|
||||
#bpy.ops.export_scene.emf(filepath="/home/heero/dev/workspace-game/atriasoft/ege/samples/resources/emf/tree1.emf")
|
||||
|
||||
#bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/workspace-game/atriasoft/ewol/resources/resources/ewol/theme/shape/Entry.blend")
|
||||
|
||||
#bpy.ops.export_scene.emf(filepath="/home/heero/dev/workspace-game/atriasoft/ewol/resources/resources/ewol/theme/shape/Entry.emf")
|
||||
#bpy.ops.export_scene.emf(filepath="/home/heero/dev/workspace-game/atriasoft/ege/samples/resources/emf/Entry.emf")
|
||||
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/truck1.blend")
|
||||
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/truck_001.emf")
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/truck2.blend")
|
||||
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/truck_002.emf")
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/truck3.blend")
|
||||
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/truck_003.emf")
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/car1.blend")
|
||||
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/car_001.emf")
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/map_2.blend")
|
||||
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/Edouard-DUPIN/zleep/resources/lowPoly/map_002.emf")
|
@ -59,7 +59,7 @@ def out_quaternion( q ):
|
||||
return "%g %g %g %g" % ( q.x, q.y, q.z, q.w )
|
||||
|
||||
|
||||
def get_physics_shape(obj, mainObjScale):
|
||||
def get_physics_shape(obj):
|
||||
shape = ""
|
||||
props = { }
|
||||
name = obj.name.lower()
|
||||
@ -73,7 +73,7 @@ def get_physics_shape(obj, mainObjScale):
|
||||
# SPHERE
|
||||
elif name.startswith('sph'):
|
||||
shape = "Sphere"
|
||||
props["radius"] = obj.scale.x * mainObjScale.x
|
||||
props["radius"] = obj.scale.x
|
||||
# CONE
|
||||
elif name.startswith('cone'):
|
||||
shape = "Cone"
|
||||
@ -116,21 +116,21 @@ def get_physics_shape(obj, mainObjScale):
|
||||
return (shape, props)
|
||||
|
||||
|
||||
def write_collision_shape(object, file, mainObjScale, offset):
|
||||
def write_collision_shape(objects, file, offset):
|
||||
fw = file.write
|
||||
if len(getChildren(object))==0:
|
||||
if len(objects)==0:
|
||||
# no phisical shape ...
|
||||
return
|
||||
string_offset = ""
|
||||
for iii in range(offset):
|
||||
string_offset += "\t"
|
||||
fw(string_offset + 'Physics:\n')
|
||||
for subObj in getChildren(object):
|
||||
for subObj in objects:
|
||||
print(" element='" + subObj.name + "' type '" + str(subObj.type) + "'")
|
||||
if subObj.type != 'MESH' \
|
||||
and subObj.type != 'EMPTY':
|
||||
continue
|
||||
(shape, props) = get_physics_shape(subObj, mainObjScale)
|
||||
(shape, props) = get_physics_shape(subObj)
|
||||
if shape=="":
|
||||
print("error of shape detection type ...");
|
||||
continue
|
||||
@ -179,7 +179,11 @@ def write_mtl(scene, file, filepath, path_mode, copy_set, mtl_dict):
|
||||
#print(" mat: ");
|
||||
#for elem in dir(mat):
|
||||
# print(" - " + elem);
|
||||
fw('Materials:%s\n' % mtl_mat_name) # Define a new material: matname_imgname
|
||||
if mtl_mat_name.lower().startswith("palette_"):
|
||||
fw('# Just for information:\nPalettes:%s\n' % mtl_mat_name[8:]) # Define a new material: matname_imgname
|
||||
else:
|
||||
fw('Materials:%s\n' % mtl_mat_name) # Define a new material: matname_imgname
|
||||
|
||||
mat_wrap = node_shader_utils.PrincipledBSDFWrapper(mat) if mat else None
|
||||
|
||||
if mat_wrap:
|
||||
@ -256,9 +260,9 @@ def write_mtl(scene, file, filepath, path_mode, copy_set, mtl_dict):
|
||||
if tex_wrap.scale != Vector((1.0, 1.0, 1.0)):
|
||||
options.append('-s %.6f %.6f %.6f' % tex_wrap.scale[:])
|
||||
if options:
|
||||
fw('%s %s %s\n' % (key, " ".join(options), repr(filepath)[1:-1]))
|
||||
fw('\t%s %s %s\n' % (key, " ".join(options), repr(filepath)[1:-1]))
|
||||
else:
|
||||
fw('%s %s\n' % (key, repr(filepath)[1:-1]))
|
||||
fw('\t%s %s\n' % (key, repr(filepath)[1:-1]))
|
||||
|
||||
else:
|
||||
# Write a dummy material here?
|
||||
@ -295,7 +299,7 @@ def write_mesh(scene, file, object, mtl_dict):
|
||||
print(object.name + 'is not a mesh type - ignoring type=' + object.type)
|
||||
fw('# can not export:"%s":type="%s"\n' % (object.name, str(object.type)))
|
||||
return
|
||||
#print("name:'%s'" % object.name)
|
||||
print("generate Object name:'%s'" % object.name)
|
||||
#for plop in object.child:
|
||||
# print(" child:'%s'" % plop.name)
|
||||
# ignore dupli children
|
||||
@ -330,8 +334,10 @@ def write_mesh(scene, file, object, mtl_dict):
|
||||
mesh_triangulate(me)
|
||||
# calculated normals:
|
||||
me.calc_normals()
|
||||
#print("nb UB layers: " + str(len(me.uv_layers)) + " " + str(dir(me.uv_layers)));
|
||||
# export UV mapping:
|
||||
faceuv = len(me.uv_layers) > 0
|
||||
# TODO: This does not work with V facing ==> need to rework it ... designed for Low poly then we use Palette
|
||||
if faceuv:
|
||||
uv_texture = me.uv_layers.active.data[:]
|
||||
uv_layer = me.uv_layers.active.data[:]
|
||||
@ -353,13 +359,27 @@ def write_mesh(scene, file, object, mtl_dict):
|
||||
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))
|
||||
if False:
|
||||
if len(materials) > 1:
|
||||
if smooth_groups:
|
||||
sort_func = lambda a: (a[0].material_index,
|
||||
smooth_groups[a[1]] if a[0].use_smooth else False)
|
||||
else:
|
||||
sort_func = lambda a: (a[0].material_index,
|
||||
a[0].use_smooth)
|
||||
else:
|
||||
# no materials
|
||||
if smooth_groups:
|
||||
sort_func = lambda a: smooth_groups[a[1] if a[0].use_smooth else False]
|
||||
else:
|
||||
sort_func = lambda a: a[0].use_smooth
|
||||
face_index_pairs.sort(key=sort_func)
|
||||
del sort_func
|
||||
else:
|
||||
# no materials
|
||||
face_index_pairs.sort(key=lambda a: a[0].use_smooth)
|
||||
face_index_pairs.sort(key=lambda a: (a[0].material_index))
|
||||
|
||||
|
||||
|
||||
# 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.
|
||||
@ -440,13 +460,21 @@ def write_mesh(scene, file, object, mtl_dict):
|
||||
###########################################################
|
||||
fw('\tFace:%d' % len(face_index_pairs))
|
||||
for f, f_index in face_index_pairs:
|
||||
f_image = None
|
||||
f_smooth = f.use_smooth
|
||||
f_mat = min(f.material_index, len(materials) - 1)
|
||||
if faceuv:
|
||||
tmp_faceuv = faceuv
|
||||
if tmp_faceuv:
|
||||
tface = uv_texture[f_index]
|
||||
f_image = tface.image
|
||||
#print("mesh_uvloop:" + str(dir(tface.uv)))
|
||||
if 'image' in dir(uv_texture[f_index]):
|
||||
f_image = tface.image
|
||||
else:
|
||||
# TODO: remove export of UV when no UV needed...
|
||||
#tmp_faceuv = False
|
||||
pass
|
||||
# MAKE KEY
|
||||
if faceuv and f_image: # Object is always true.
|
||||
if tmp_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.
|
||||
@ -481,10 +509,10 @@ def write_mesh(scene, file, object, mtl_dict):
|
||||
mat_data = mtl_dict[key] = mtl_name, materials[f_mat], f_image
|
||||
mtl_rev_dict[mtl_name] = key
|
||||
# set the use of a material:
|
||||
fw("\n\t\t%s\n\t\t\t" % mat_data[0]) # can be mat_image or (null)
|
||||
fw("\n\t\t%s\n\t\t\t" % mat_data[0].replace("palette_", "palette:")) # 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:
|
||||
if tmp_faceuv:
|
||||
# export the normals:
|
||||
if f_smooth: # Smoothed, use vertex normals
|
||||
for vi, v in f_v:
|
||||
@ -546,7 +574,7 @@ def write_mesh(scene, file, object, mtl_dict):
|
||||
" @brief Basic write function. The context and options must be already set.
|
||||
"""
|
||||
def write_file(filepath,
|
||||
objects,
|
||||
collection,
|
||||
scene,
|
||||
EXPORT_PATH_MODE='AUTO',
|
||||
EXPORT_BINARY_MODE=False,
|
||||
@ -592,25 +620,18 @@ def write_file(filepath,
|
||||
print("nb_total_physic: " + str(nb_total_physic))
|
||||
"""
|
||||
|
||||
print("Find Mesh in collection: '" + str(collection.name) + "'")
|
||||
# Get all meshes
|
||||
for ob_main in objects:
|
||||
for ob_main in collection.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 ...")
|
||||
|
||||
|
||||
print("Find Physics in collection: '" + str(collection.name) + "'")
|
||||
for col in collection.children:
|
||||
print(" - name: " + str(col.name) + "/" + str(col.name_full) )
|
||||
if col.name.lower().startswith("physic"):
|
||||
write_collision_shape(col.objects, file, 0)
|
||||
|
||||
#####################################################################
|
||||
## Now we have all our materials, save them in the material section
|
||||
#####################################################################
|
||||
@ -653,14 +674,27 @@ def _write(context,
|
||||
scene.frame_set(frame, subframe=0.0)
|
||||
# get only the object that are selected or all...
|
||||
if EXPORT_SEL_ONLY:
|
||||
objects = context.selected_objects
|
||||
collection = bpy.context.collection
|
||||
else:
|
||||
objects = scene.objects
|
||||
print("collection auto detect 'root': ")
|
||||
collection = scene.collection
|
||||
if collection.name != "root":
|
||||
for col in collection.children:
|
||||
if col.name == "root":
|
||||
collection = col
|
||||
break
|
||||
if collection.name != "root":
|
||||
raise "Can not detect collection 'root'"
|
||||
|
||||
#print("* collection name: " + str(collection.name) + "/" + str(collection.name_full) )
|
||||
print("============================================================================================");
|
||||
draw_tree(scene.collection, 0, collection);
|
||||
print("============================================================================================");
|
||||
|
||||
full_path = ''.join(context_name)
|
||||
|
||||
write_file(full_path,
|
||||
objects,
|
||||
collection,
|
||||
scene,
|
||||
EXPORT_PATH_MODE,
|
||||
EXPORT_BINARY_MODE,
|
||||
@ -669,6 +703,24 @@ def _write(context,
|
||||
|
||||
|
||||
|
||||
|
||||
##
|
||||
## Display all the element in the collection tree (for help debug exporting)
|
||||
##
|
||||
def draw_tree(collection, offset, export_collection):
|
||||
string_offset = ""
|
||||
for iii in range(offset):
|
||||
string_offset += "\t"
|
||||
if export_collection == collection:
|
||||
print(string_offset + "- collection: '" + str(collection.name) + "' !!!! exported node !!!!")
|
||||
else:
|
||||
print(string_offset + "- collection: '" + str(collection.name) + "'")
|
||||
for col in collection.children:
|
||||
draw_tree(col, offset+1, export_collection);
|
||||
if 'objects' in dir(collection):
|
||||
for obj in collection.objects:
|
||||
print(string_offset + "\t- objects: '" + str(obj.name) + "' type '" + str(obj.type) + "'")
|
||||
|
||||
"""
|
||||
" @brief Save the current element in the file requested.
|
||||
"
|
||||
|
@ -460,9 +460,7 @@ def write_file(filepath, objects, depsgraph, scene,
|
||||
if faceuv:
|
||||
# in case removing some of these dont get defined.
|
||||
uv = f_index = uv_index = uv_key = uv_val = uv_ls = None
|
||||
|
||||
uv_face_mapping = [None] * len(face_index_pairs)
|
||||
|
||||
uv_dict = {}
|
||||
uv_get = uv_dict.get
|
||||
for f, f_index in face_index_pairs:
|
||||
@ -471,21 +469,17 @@ def write_file(filepath, objects, depsgraph, scene,
|
||||
uv = uv_layer[l_index].uv
|
||||
# include the vertex index in the key so we don't share UV's between vertices,
|
||||
# allowed by the OBJ spec but can cause issues for other importers, see: T47010.
|
||||
|
||||
# this works too, shared UV's for all verts
|
||||
#~ uv_key = veckey2d(uv)
|
||||
uv_key = loops[l_index].vertex_index, veckey2d(uv)
|
||||
|
||||
uv_val = uv_get(uv_key)
|
||||
if uv_val is None:
|
||||
uv_val = uv_dict[uv_key] = uv_unique_count
|
||||
fw('vt %.6f %.6f\n' % uv[:])
|
||||
uv_unique_count += 1
|
||||
uv_ls.append(uv_val)
|
||||
|
||||
del uv_dict, uv, f_index, uv_index, uv_ls, uv_get, uv_key, uv_val
|
||||
# Only need uv_unique_count and uv_face_mapping
|
||||
|
||||
subprogress2.step()
|
||||
|
||||
# NORMAL, Smooth/Non smoothed.
|
||||
|
167
lutin_org-atriasoft-ege.py
Normal file
@ -0,0 +1,167 @@
|
||||
#!/usr/bin/python
|
||||
import realog.debug as debug
|
||||
import lutin.tools as tools
|
||||
import realog.debug as debug
|
||||
import lutin.image as image
|
||||
import os
|
||||
import lutin.multiprocess as lutinMultiprocess
|
||||
|
||||
|
||||
def get_type():
|
||||
return "LIBRARY_DYNAMIC"
|
||||
|
||||
def get_desc():
|
||||
return "Ewol Tool Kit"
|
||||
|
||||
def get_licence():
|
||||
return "MPL-2"
|
||||
|
||||
def get_compagny_type():
|
||||
return "org"
|
||||
|
||||
def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
#def get_maintainer():
|
||||
# return "authors.txt"
|
||||
|
||||
#def get_version():
|
||||
# return "version.txt"
|
||||
|
||||
def configure(target, my_module):
|
||||
|
||||
my_module.add_src_file([
|
||||
'src/entities/Light.java',
|
||||
'src/entities/Player.java',
|
||||
'src/entities/Entity.java',
|
||||
'src/entities/Camera.java',
|
||||
'src/shaders/ShaderProgram.java',
|
||||
'src/shaders/StaticShader.java',
|
||||
'src/shaders/TerrainShader.java',
|
||||
'src/renderEngine/DisplayManagerDraw.java',
|
||||
'src/renderEngine/DisplayManager.java',
|
||||
'src/renderEngine/TerrainRenderer.java',
|
||||
'src/renderEngine/EntityRenderer.java',
|
||||
'src/renderEngine/MasterRenderer.java',
|
||||
'src/renderEngine/Loader.java',
|
||||
'src/renderEngine/OBJLoader.java',
|
||||
'src/module-info.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Sphere.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Box.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Capsule.java',
|
||||
'src/org/atriasoft/ege/physics/shape/ConvexHull.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Concave.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Shape.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Cone.java',
|
||||
'src/org/atriasoft/ege/physics/shape/Cylinder.java',
|
||||
'src/org/atriasoft/ege/Ege.java',
|
||||
'src/org/atriasoft/ege/CreatorEntity.java',
|
||||
'src/org/atriasoft/ege/Light.java',
|
||||
'src/org/atriasoft/ege/EntityInteraction.java',
|
||||
'src/org/atriasoft/ege/engines/EngineParticle.java',
|
||||
'src/org/atriasoft/ege/engines/EngineDynamicMeshs.java',
|
||||
'src/org/atriasoft/ege/engines/EngineMap.java',
|
||||
'src/org/atriasoft/ege/engines/EngineAI.java',
|
||||
'src/org/atriasoft/ege/engines/EnginePhysics.java',
|
||||
'src/org/atriasoft/ege/engines/EnginePlayer.java',
|
||||
'src/org/atriasoft/ege/engines/EngineGravity.java',
|
||||
'src/org/atriasoft/ege/engines/EngineRender.java',
|
||||
'src/org/atriasoft/ege/engines/EngineLight.java',
|
||||
'src/org/atriasoft/ege/ControlCameraPlayerFPS.java',
|
||||
'src/org/atriasoft/ege/internal/LOGGER.java',
|
||||
'src/org/atriasoft/ege/geometry/AABB.java',
|
||||
'src/org/atriasoft/ege/geometry/Sphere.java',
|
||||
'src/org/atriasoft/ege/geometry/Ray.java',
|
||||
'src/org/atriasoft/ege/geometry/Plane.java',
|
||||
'src/org/atriasoft/ege/geometry/OBB.java',
|
||||
'src/org/atriasoft/ege/geometry/Geometry3D.java',
|
||||
'src/org/atriasoft/ege/geometry/Line.java',
|
||||
'src/org/atriasoft/ege/geometry/Triangle.java',
|
||||
'src/org/atriasoft/ege/ControlCameraPlayer.java',
|
||||
'src/org/atriasoft/ege/Material.java',
|
||||
'src/org/atriasoft/ege/ResultNearestEntity.java',
|
||||
'src/org/atriasoft/ege/Component.java',
|
||||
'src/org/atriasoft/ege/Environement.java',
|
||||
'src/org/atriasoft/ege/Signal.java',
|
||||
'src/org/atriasoft/ege/map/MapVoxel.java',
|
||||
'src/org/atriasoft/ege/map/VoxelType.java',
|
||||
'src/org/atriasoft/ege/map/VoxelChunk.java',
|
||||
'src/org/atriasoft/ege/map/ComponentDynamicMeshsVoxelMap.java',
|
||||
'src/org/atriasoft/ege/map/Voxel.java',
|
||||
'src/org/atriasoft/ege/map/ComponentRenderVoxelMesh.java',
|
||||
'src/org/atriasoft/ege/camera/Camera.java',
|
||||
'src/org/atriasoft/ege/Entity.java',
|
||||
'src/org/atriasoft/ege/Engine.java',
|
||||
'src/org/atriasoft/ege/components/ComponentTextures.java',
|
||||
'src/org/atriasoft/ege/components/ComponentMaterials.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRender.java',
|
||||
'src/org/atriasoft/ege/components/ComponentMaterial.java',
|
||||
'src/org/atriasoft/ege/components/ComponentTexturePalette.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRenderTexturedStaticMesh.java',
|
||||
'src/org/atriasoft/ege/components/ComponentLightSun.java',
|
||||
'src/org/atriasoft/ege/components/ComponentTexturePack.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRenderColoredStaticMesh.java',
|
||||
'src/org/atriasoft/ege/components/ComponentMap.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsStaticMesh.java',
|
||||
'src/org/atriasoft/ege/components/ComponentPhysics.java',
|
||||
'src/org/atriasoft/ege/components/ComponentDynamicMeshs.java',
|
||||
'src/org/atriasoft/ege/components/ComponentMesh.java',
|
||||
'src/org/atriasoft/ege/components/ComponentPlayer.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRenderMeshPalette.java',
|
||||
'src/org/atriasoft/ege/components/ComponentGravityStatic.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsStaticMeshs.java',
|
||||
'src/org/atriasoft/ege/components/ComponentGravity.java',
|
||||
'src/org/atriasoft/ege/components/ComponentPositionPlayer.java',
|
||||
'src/org/atriasoft/ege/components/ComponentLight.java',
|
||||
'src/org/atriasoft/ege/components/part/LightRender.java',
|
||||
'src/org/atriasoft/ege/components/part/MaterialRenderBase.java',
|
||||
'src/org/atriasoft/ege/components/part/MaterialsRender.java',
|
||||
'src/org/atriasoft/ege/components/part/PartRenderInterface.java',
|
||||
'src/org/atriasoft/ege/components/part/TransformRender.java',
|
||||
'src/org/atriasoft/ege/components/part/MaterialRender.java',
|
||||
'src/org/atriasoft/ege/components/part/PositionningInterface.java',
|
||||
'src/org/atriasoft/ege/components/GlLightIndex.java',
|
||||
'src/org/atriasoft/ege/components/ComponentStaticMeshs.java',
|
||||
'src/org/atriasoft/ege/components/ComponentPosition.java',
|
||||
'src/org/atriasoft/ege/components/ComponentAI.java',
|
||||
'src/org/atriasoft/ege/components/PhysicBodyType.java',
|
||||
'src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsDynamicMeshs.java',
|
||||
'src/org/atriasoft/ege/components/ComponentTexture.java',
|
||||
'src/org/atriasoft/ege/components/ComponentStaticMesh.java',
|
||||
'src/org/atriasoft/ege/components/ComponentParticle.java',
|
||||
'src/org/atriasoft/ege/tools/MeshGenerator.java',
|
||||
'src/org/atriasoft/ege/ControlCameraSimple.java',
|
||||
'src/org/atriasoft/ege/ControlInterface.java',
|
||||
'src/org/atriasoft/ege/GameStatus.java',
|
||||
'src/skybox/SkyboxShader.java',
|
||||
'src/skybox/SkyboxRenderer.java',
|
||||
'src/terrains/TerrainTexture.java',
|
||||
'src/terrains/TerrainTexturePack.java',
|
||||
'src/terrains/Terrain.java',
|
||||
'src/guis/GuiTexture.java',
|
||||
'src/guis/GuiRenderer.java',
|
||||
'src/guis/GuiShader.java',
|
||||
'src/textures/ModelTexture.java',
|
||||
'src/textures/TextureData.java',
|
||||
'src/toolbox/Maths.java',
|
||||
'src/models/RawModel.java',
|
||||
'src/models/TexturedModel.java',
|
||||
])
|
||||
my_module.add_path('src/', type='java')
|
||||
|
||||
my_module.add_depend([
|
||||
'org-atriasoft-ewol',
|
||||
'org-atriasoft-ephysics',
|
||||
'org-atriasoft-loader3d',
|
||||
])
|
||||
|
||||
#my_module.add_path([
|
||||
# 'lib/spotbugs-annotations-4.2.2.jar'
|
||||
# ],
|
||||
# type='java',
|
||||
# export=True
|
||||
#);
|
||||
my_module.add_flag('java', "RELEASE_15_PREVIEW");
|
||||
|
||||
return True
|
||||
|
160
pom.xml
Normal file
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>ege</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Mozilla Public License 2.0</name>
|
||||
<url>https://opensource.org/licenses/MPL-2.0</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>dev1</id>
|
||||
<name>Edouard DUPIN</name>
|
||||
<email>edouard.dupin@proton.me</email>
|
||||
<roles>
|
||||
<role>Lead Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>ewol</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>ephysics</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>loader3d</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.1.0-alpha1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/src/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<testSourceDirectory>src/test</testSourceDirectory>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>${basedir}/src/testResources</directory>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Create the source bundle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- junit results -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.2.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>fully.qualified.MainClass</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Java-doc generation for stand-alone site -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<show>private</show>
|
||||
<nohelp>true</nohelp>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<!-- Generate Java-docs As Part Of Project Reports -->
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
</project>
|
@ -1,16 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
in vec4 io_color;
|
||||
|
||||
// output:
|
||||
out vec4 out_Color;
|
||||
|
||||
void main(void) {
|
||||
out_Color = io_color;
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
// Input :
|
||||
in vec3 in_position;
|
||||
uniform vec4 in_colors;
|
||||
uniform mat4 in_matrixTransformation;
|
||||
uniform mat4 in_matrixProjection;
|
||||
uniform mat4 in_matrixView;
|
||||
|
||||
// output :
|
||||
out vec4 io_color;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * vec4(in_position, 1.0);
|
||||
io_color = vec4(in_colors.xyz, 0.3);
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
in vec4 io_color;
|
||||
|
||||
// output:
|
||||
out vec4 out_Color;
|
||||
|
||||
void main(void) {
|
||||
out_Color = vec4(1.0,0.0,0.0,1.0);
|
||||
// io_color;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#version 400 core
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
// Input:
|
||||
in vec3 in_position;
|
||||
in vec4 in_colors;
|
||||
uniform mat4 in_matrixTransformation;
|
||||
uniform mat4 in_matrixProjection;
|
||||
uniform mat4 in_matrixView;
|
||||
|
||||
// output:
|
||||
out vec4 io_color;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * vec4(in_position, 1.0);
|
||||
io_color = in_colors;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?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>
|
3
samples/.gitignore
vendored
@ -1 +1,4 @@
|
||||
|
||||
/__pycache__/
|
||||
/bin/
|
||||
/target/
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?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>
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.ui.text.custom_code_templates=
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
1618
samples/hs_err_pid14064.log
Normal file
120
samples/pom.xml
Normal file
@ -0,0 +1,120 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>ege-sample</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<properties>
|
||||
<maven.compiler.version>3.13.0</maven.compiler.version>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.dependency.version>3.1.1</maven.dependency.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>ege</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.1.0-alpha1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/src/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.compiler.version}</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
<!--<encoding>${project.build.sourceEncoding}</encoding>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Create the source bundle -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- junit results -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>fully.qualified.MainClass</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Java-doc generation for stand-alone site -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<show>private</show>
|
||||
<nohelp>true</nohelp>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<!-- Generate Java-docs As Part Of Project Reports -->
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
</project>
|
@ -1,3 +0,0 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'tree1.blend'
|
||||
|
@ -1,13 +0,0 @@
|
||||
/** Basic module interface.
|
||||
*
|
||||
* @author Edouard DUPIN */
|
||||
|
||||
open module sample.atriasoft.ege {
|
||||
exports sample.atriasoft.ege.collisiontest;
|
||||
exports sample.atriasoft.ege.lowPoly;
|
||||
exports sample.atriasoft.ege.loxelEngine;
|
||||
exports sample.atriasoft.ege.oldTest;
|
||||
exports sample.atriasoft.ege.s1_texturedCube;
|
||||
|
||||
requires org.atriasoft.ege;
|
||||
}
|
71
samples/src/resources/resources/lowPoly/data/Entry.emf
Normal file
@ -0,0 +1,71 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'Entry.blend'
|
||||
Mesh:EntryBox_Cube
|
||||
Vertex:16
|
||||
20.042355 7.751226 20.042355|20.042355 7.751226 -20.042355|20.042355 -4.633502 20.042355|20.042355 -4.633502 -20.042355|-20.042355 7.751226 20.042355|-20.042355 7.751226 -20.042355|-20.042355 -4.633502 20.042355|-20.042355 -4.633502 -20.042355|10.127714 -7.726907 10.127714|10.127714 -7.726907 -10.127714|-10.127714 -7.726907 10.127714|-10.127714 -7.726907 -10.127714|-10.127714 -9.146553 -10.127714|-10.127714 -9.146553 10.127714|10.127714 -9.146553 10.127714|10.127714 -9.146553 -10.127714|
|
||||
UV-mapping:
|
||||
0.000100 0.000100|0.999900 0.999900|0.000100 0.999900|0.999900 0.000100|0.074219 0.995849|0.120606 0.943115|0.121582 0.993408|0.112927 0.992387|0.078245 0.948093|0.073324 0.991157|0.101769 0.970961|0.080974 0.959440|0.102023 0.957458|0.111927 0.985005|0.078476 0.953015|0.082167 0.983774|0.074219 0.944092|0.111696 0.944402|0.080720 0.975385|0.113157 0.949323|0.174907 0.947863|0.131613 0.991157|0.132843 0.945402|0.178368 0.944941|0.137534 0.984544|0.142456 0.948632|0.171985 0.949093|0.136074 0.991157|0.137304 0.950323|0.174677 0.949093|0.135074 0.992387|0.136304 0.949093|0.178598 0.993618|0.178368 0.988235|0.173216 0.991157|0.175907 0.989926|0.013265 0.951784|0.051868 0.992387|0.013034 0.993618|0.054098 0.951784|0.137534 0.988235|0.177138 0.947863|0.135074 0.947862|0.172446 0.988465|
|
||||
Normal(face):22
|
||||
0.000000 -1.000000 0.000000|-0.297843 -0.954615 0.000000|0.000000 -0.954615 -0.297843|0.000000 -0.954615 0.297843|0.297843 -0.954615 0.000000|0.000000 0.000000 1.000000|-1.000000 0.000000 0.000000|0.000000 0.000000 -1.000000|1.000000 0.000000 -0.000000|0.000000 1.000000 -0.000000|
|
||||
Face:22
|
||||
gui_dynamic_1
|
||||
14/0/0 12/1/0 15/2/0| 14/0/0 13/3/0 12/1/0|
|
||||
palette:gui_border_1
|
||||
7/4/1 10/5/1 6/6/1| 3/7/2 11/8/2 7/9/2| 6/10/3 8/11/3 2/12/3| 2/13/4 9/14/4 3/15/4| 7/4/1 11/16/1 10/5/1| 3/7/2 9/17/2 11/8/2| 6/10/3 10/18/3 8/11/3| 2/13/4 8/19/4 9/14/4|
|
||||
palette:gui_border_2
|
||||
4/20/5 2/21/5 0/22/5| 6/23/6 5/24/6 7/25/6| 1/26/7 7/27/7 5/28/7| 0/29/8 3/30/8 1/31/8| 4/20/5 6/32/5 2/21/5| 6/23/6 4/33/6 5/24/6| 1/26/7 3/34/7 7/27/7| 0/29/8 2/35/8 3/30/8|
|
||||
palette:gui_center
|
||||
9/36/0 10/37/0 11/38/0| 9/36/0 8/39/0 10/37/0|
|
||||
palette:gui_back
|
||||
5/40/9 0/41/9 1/42/9| 5/40/9 4/43/9 0/41/9|
|
||||
|
||||
Materials:gui_dynamic_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd /home/heero/dev/workspace-game/atriasoft/ewol/resources/resources/ewol/theme/shape/empty_area.png
|
||||
# Just for information:
|
||||
Palettes:gui_back
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.000000 0.005632
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:gui_border_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.002615 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:gui_border_2
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.800000 0.170495
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:gui_center
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.438544 0.438544 0.438544
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
@ -11,12 +11,7 @@ struct Light {
|
||||
vec3 attenuation;
|
||||
};
|
||||
|
||||
struct Material {
|
||||
vec3 ambientFactor;
|
||||
vec3 diffuseFactor;
|
||||
vec3 specularFactor;
|
||||
float shininess;
|
||||
};
|
||||
|
||||
const int MAX_LIGHT_NUMBER = 8;
|
||||
|
||||
|
||||
@ -30,7 +25,7 @@ in float io_fowVisibility;
|
||||
// texture properties
|
||||
uniform sampler2D in_textureBase;
|
||||
// Material
|
||||
uniform Material in_material;
|
||||
//uniform Material in_material;
|
||||
// 2 light for suns and other for locals ...
|
||||
uniform Light in_lights[MAX_LIGHT_NUMBER];
|
||||
// global color of the sky ... needed to have a better color for the FOW
|
||||
@ -43,10 +38,20 @@ out vec4 out_Color;
|
||||
void main(void) {
|
||||
// disable transparency elements in the texture ...
|
||||
// Can be set at the start of the shader ...
|
||||
/*
|
||||
vec4 textureColour = texture(in_textureBase, io_textureCoords);
|
||||
if (textureColour.a < 0.5) {
|
||||
discard;
|
||||
}
|
||||
*/
|
||||
//vec4 textureColour = vec4(1.0,1.0,1.0,1.0);
|
||||
// keep material:
|
||||
vec3 tex_ambientFactor = texture(in_textureBase, vec2(io_textureCoords.x, 4.5/8.0)).xyz;
|
||||
//vec3 tex_diffuseFactor = texture(in_textureBase, vec2(io_textureCoords.x, 0.5/8.0)).xyz;
|
||||
//vec4 textureColour = texture(in_textureBase, vec2(io_textureCoords.x, 0.5/8.0));
|
||||
vec4 textureColour = texture(in_textureBase, io_textureCoords);
|
||||
vec3 tex_specularFactor = texture(in_textureBase, vec2(io_textureCoords.x, 2.5/8.0)).xyz;
|
||||
float tex_shininess = texture(in_textureBase, vec2(io_textureCoords.x, 6.5/8.0)).x;
|
||||
|
||||
vec3 unitNormal = normalize(io_surfaceNormal);
|
||||
vec3 unitVectorToCamera = normalize(io_toCameraVector);
|
||||
@ -62,17 +67,19 @@ void main(void) {
|
||||
vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);
|
||||
float specularFactor = dot(reflectedLightDirection, unitVectorToCamera);
|
||||
specularFactor = max(specularFactor, 0.0);
|
||||
float damperFactor = pow(specularFactor, in_material.shininess);
|
||||
vec3 diffuse = (brightness * in_lights[iii].color) / attenuationFactor;;
|
||||
vec3 finalSpecular = (damperFactor * in_material.specularFactor.x * in_lights[iii].color) / attenuationFactor; // TODO: Remove the x ....
|
||||
float damperFactor = pow(specularFactor, tex_shininess);
|
||||
vec3 diffuse = (brightness * in_lights[iii].color) / attenuationFactor;
|
||||
vec3 finalSpecular = (damperFactor * tex_specularFactor.x * in_lights[iii].color) / attenuationFactor; // TODO: Remove the x ....
|
||||
totalDiffuse = totalDiffuse + diffuse;
|
||||
totalSpecular = totalSpecular + finalSpecular;
|
||||
}
|
||||
// the 0.2 represent the ambiant lightning ==> maybe set an uniform for this
|
||||
totalDiffuse = max(totalDiffuse, 0.2);
|
||||
//totalDiffuse = max(totalDiffuse, 1.0);
|
||||
//totalDiffuse = min(totalDiffuse, 0.4);
|
||||
|
||||
out_Color = vec4(totalDiffuse,1.0) * textureColour + vec4(totalSpecular, 1.0);
|
||||
out_Color = mix(vec4(in_sky_color,1.0), out_Color, io_fowVisibility);
|
||||
//////out_Color = vec4(totalDiffuse,1.0) * textureColour + vec4(totalSpecular, 1.0);
|
||||
out_Color = (vec4(totalDiffuse,1.0)*0.5+0.5) * textureColour;
|
||||
/////out_Color = mix(vec4(in_sky_color,1.0), out_Color, io_fowVisibility);
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,9 @@ struct Light {
|
||||
const int MAX_LIGHT_NUMBER = 8;
|
||||
|
||||
// Input:
|
||||
in vec3 in_position;
|
||||
in vec3 in_normal;
|
||||
in vec2 in_textureCoords;
|
||||
layout (location = 0) in vec3 in_position;
|
||||
layout (location = 1) in vec2 in_textureCoords;
|
||||
layout (location = 2) in vec3 in_normal;
|
||||
// 2 light for suns and other for locals ...
|
||||
uniform Light in_lights[MAX_LIGHT_NUMBER];
|
||||
|
@ -2,14 +2,14 @@
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v 0.499999 0.499999 -0.499999
|
||||
v 0.499999 -0.499999 -0.499999
|
||||
v 0.499999 0.499999 0.499999
|
||||
v 0.499999 -0.499999 0.499999
|
||||
v -0.499999 0.499999 -0.499999
|
||||
v -0.499999 -0.499999 -0.499999
|
||||
v -0.499999 0.499999 0.499999
|
||||
v -0.499999 -0.499999 0.499999
|
||||
v 0.5 0.5 -0.5
|
||||
v 0.5 -0.5 -0.5
|
||||
v 0.5 0.5 0.5
|
||||
v 0.5 -0.5 0.5
|
||||
v -0.5 0.5 -0.5
|
||||
v -0.5 -0.5 -0.5
|
||||
v -0.5 0.5 0.5
|
||||
v -0.5 -0.5 0.5
|
||||
vt 0.875000 0.500000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.625000 0.500000
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 182 KiB |
41
samples/src/resources/resources/lowPoly/data/palette_1.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"default": {
|
||||
"Ns":225.000000,
|
||||
"Ka":"1.000000 1.000000 1.000000",
|
||||
"Kd":"0.346704 0.558341 0.090842",
|
||||
"Ks":"0.500000 0.500000 0.500000",
|
||||
"Ke":"0.000000 0.000000 0.000000",
|
||||
"vNi":1.000000,
|
||||
"d":1.000000,
|
||||
"illum":2
|
||||
},
|
||||
"palette": {
|
||||
"leaf_1":{
|
||||
"Kd":"0.346704 0.558341 0.090842"
|
||||
},
|
||||
"leaf_2":{
|
||||
"Kd":"0.278894 0.278894 0.023153"
|
||||
},
|
||||
"leaf_3":{
|
||||
"Kd":"0.800000 0.800000 0.800000"
|
||||
},
|
||||
"trunk_1":{
|
||||
"Kd":"0.25 0.13 0.07"
|
||||
},
|
||||
"trunk_2":{
|
||||
"Kd":"0.057805 0.039546 0.013702"
|
||||
},
|
||||
"grass_1":{
|
||||
"Kd":"0.057805 1.0 0.013702"
|
||||
},
|
||||
"grass_2":{
|
||||
"Kd":"1.0 0.0 0.013702"
|
||||
},
|
||||
"grass_3":{
|
||||
"Kd":"1.0 1.0 0.013702"
|
||||
},
|
||||
"grass_4":{
|
||||
"Kd":"0.0 0.0 1.0"
|
||||
}
|
||||
}
|
||||
}
|
67
samples/src/resources/resources/lowPoly/data/simple3D.emf
Normal file
@ -0,0 +1,67 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'simple3D.blend'
|
||||
Mesh:Arbre_Normal_Mesh
|
||||
Vertex:17
|
||||
3.051021 3.620651 -2.087459|5.582213 1.032425 -2.087459|4.922988 -2.135247 -2.087459|1.459509 -4.026786 -2.087459|-2.779363 -3.534152 -2.087459|-5.310555 -0.945922 -2.087459|-4.651330 2.221750 -2.087459|-1.187852 4.113286 -2.087459|1.442891 1.647222 2.690865|2.577781 0.486759 2.690865|2.282209 -0.933506 2.690865|0.729316 -1.781600 2.690865|-1.171233 -1.560721 2.690865|-2.306123 -0.400256 2.690865|-2.010551 1.020007 2.690865|-0.457659 1.868100 2.690865|13.475907 -19.707346 33.057674|
|
||||
Normal(face):28
|
||||
0.000000 0.000000 -1.000000|0.842352 -0.175302 0.509620|-0.105309 -0.906134 0.409672|-0.842352 0.175302 0.509620|0.105309 0.906134 0.409672|0.842351 -0.175302 0.509621|-0.105310 -0.906134 0.409672|-0.842351 0.175302 0.509621|0.000000 0.000000 1.000000|0.631866 0.617942 0.467860|0.431163 -0.789476 0.436837|0.431163 -0.789476 0.436838|-0.631866 -0.617941 0.467860|-0.431162 0.789476 0.436838|
|
||||
Face:28
|
||||
palette:trunk_1
|
||||
7/0 4/0 6/0| 9/1 2/1 1/1| 3/2 12/2 4/2| 13/3 6/3 5/3| 7/4 8/4 0/4| 7/0 0/0 3/0| 0/0 1/0 2/0| 3/0 0/0 2/0| 3/0 4/0 7/0| 4/0 5/0 6/0| 9/5 10/5 2/5| 3/6 11/6 12/6| 13/7 14/7 6/7| 7/4 15/4 8/4|
|
||||
palette:leaf_1
|
||||
11/8 10/8 8/8| 9/8 8/8 10/8| 8/8 15/8 11/8| 15/8 14/8 12/8| 14/8 13/8 12/8| 12/8 11/8 15/8|
|
||||
palette:leaf_2
|
||||
0/9 9/9 1/9| 10/10 3/10 2/10| 0/9 8/9 9/9| 10/11 11/11 3/11|
|
||||
palette:leaf_3
|
||||
4/12 13/12 5/12| 14/13 7/13 6/13| 4/12 12/12 13/12| 14/13 15/13 7/13|
|
||||
Physics:
|
||||
Cylinder
|
||||
radius:0.25
|
||||
size:2.0
|
||||
origin:0.0117903 0.0311268 0.962411
|
||||
mass:6.25
|
||||
Sphere
|
||||
radius:1.3350000381469727
|
||||
origin:-0.093534 -0.0233787 2.81849
|
||||
mass:237.92705789594712
|
||||
|
||||
# Just for information:
|
||||
Palettes:leaf_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.346704 0.558341 0.090842
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:leaf_2
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.278894 0.278894 0.023153
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:leaf_3
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:trunk_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.057805 0.039546 0.013702
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
57
samples/src/resources/resources/lowPoly/data/tower.emf
Normal file
@ -0,0 +1,57 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'tower.blend'
|
||||
Mesh:tower_Cube
|
||||
Vertex:68
|
||||
1.000000 1.000000 1.968156|1.000000 1.000000 0.509101|1.000000 -1.000000 1.968156|1.000000 -1.000000 0.509101|-1.000000 1.000000 1.968156|-1.000000 1.000000 0.509101|-1.000000 -1.000000 1.968156|-1.000000 -1.000000 0.509101|0.519091 0.519091 2.988363|0.519091 -0.519091 2.988363|-0.519091 0.519091 2.988363|-0.519091 -0.519091 2.988363|1.267435 0.519091 3.279218|1.267435 -0.519091 3.279218|-0.519091 0.519091 3.279218|-0.519091 -0.519091 3.279218|1.267435 0.519091 4.102064|1.267435 -0.519091 4.102064|-0.519091 0.519091 4.102064|-0.519091 -0.519091 4.102064|-1.007701 0.133857 3.584548|-1.007701 -0.133857 3.584548|-1.007701 0.133857 3.796734|-1.007701 -0.133857 3.796734|-3.394721 0.108124 3.604944|-3.394721 -0.108124 3.604944|-3.394721 0.108124 3.776338|-3.394721 -0.108124 3.776338|-3.394721 0.148343 3.573067|-3.394721 -0.148343 3.573067|-3.394721 0.148343 3.808215|-3.394721 -0.148343 3.808215|-3.865651 0.148343 3.573067|-3.865651 -0.148343 3.573067|-3.865651 0.148343 3.808215|-3.865651 -0.148343 3.808215|0.468620 0.227433 3.055862|0.468620 -0.227433 3.055862|-0.227433 0.227433 3.055862|-0.227433 -0.227433 3.055862|0.671236 0.227433 3.376956|0.671236 -0.227433 3.376956|0.216371 0.227433 3.376956|0.216371 -0.227433 3.376956|1.304951 1.304951 0.327262|1.304951 -1.304951 0.327262|-1.304951 1.304951 0.327262|-1.304951 -1.304951 0.327262|1.304951 1.304951 -0.001257|1.304951 -1.304951 -0.001257|-1.304951 1.304951 -0.001257|-1.304951 -1.304951 -0.001257|1.644974 0.319018 3.437792|1.644974 -0.319018 3.437792|1.644974 0.319018 3.943490|1.644974 -0.319018 3.943490|1.469387 0.154815 3.567937|1.469387 -0.154815 3.567937|1.469387 0.154815 3.813344|1.469387 -0.154815 3.813344|-3.865651 0.081533 3.626019|-3.865651 -0.081533 3.626019|-3.865651 0.081533 3.755262|-3.865651 -0.081533 3.755262|0.301836 0.081533 3.626019|0.301836 -0.081533 3.626019|0.301836 0.081533 3.755262|0.301836 -0.081533 3.755262|
|
||||
Normal(face):128
|
||||
-0.000000 0.000000 -1.000000|0.000000 1.000000 -0.000000|0.000000 -0.225474 0.974249|-0.225474 0.000000 0.974249|0.000000 0.000000 1.000000|-0.619140 0.785281 0.000000|0.000000 -1.000000 0.000000|-0.529936 0.000000 0.848038|-0.619140 -0.785281 0.000000|-0.529936 0.000000 -0.848038|1.000000 -0.000000 -0.000000|-1.000000 0.000000 0.000000|0.000000 0.225474 0.974249|0.800875 0.000000 0.598832|0.845703 0.000000 -0.533654|-0.586173 0.000000 0.810186|0.595465 0.000000 0.803381|0.683034 0.730387 0.000000|0.595465 0.000000 -0.803381|0.683034 -0.730387 0.000000|0.468253 0.883595 0.000000|-0.010780 -0.999942 0.000000|-0.008544 0.000000 0.999964|-0.010780 0.999942 0.000000|-0.008544 0.000000 -0.999964|0.387250 0.000000 0.921975|0.468253 -0.883595 0.000000|0.387250 0.000000 -0.921975|-0.008544 0.000000 0.999963|-0.008544 -0.000000 -0.999963|0.000000 0.904541 0.426386|0.000000 -0.904541 0.426386|-0.904541 0.000000 0.426386|0.904541 0.000000 0.426386|-0.000000 -0.512150 0.858896|-0.512150 0.000000 0.858896|0.512150 0.000000 0.858896|-0.000000 0.512150 0.858896|
|
||||
Face:128
|
||||
palette:canon_2
|
||||
15/0 12/0 13/0| 14/1 16/1 12/1| 9/2 39/2 11/2| 36/1 42/1 40/1| 11/3 38/3 10/3| 18/4 17/4 16/4| 14/5 22/5 18/5| 13/6 19/6 15/6| 18/7 23/7 19/7| 19/8 21/8 15/8| 15/9 20/9 14/9| 26/10 31/10 27/10| 28/1 34/1 30/1| 24/10 30/10 26/10| 25/10 28/10 24/10| 27/10 29/10 25/10| 35/11 61/11 33/11| 29/0 32/0 28/0| 31/6 33/6 29/6| 30/4 35/4 31/4| 8/12 38/12 36/12| 8/13 37/13 9/13| 40/4 43/4 41/4| 36/14 41/14 37/14| 37/6 43/6 39/6| 39/15 42/15 38/15| 52/16 57/16 53/16| 56/10 59/10 57/10| 53/17 59/17 55/17| 55/18 58/18 54/18| 54/19 56/19 52/19| 60/6 66/6 62/6| 34/11 63/11 35/11| 32/11 62/11 34/11| 33/11 60/11 32/11| 65/11 66/11 64/11| 61/4 64/4 60/4| 63/1 65/1 61/1| 62/0 67/0 63/0| 15/0 14/0 12/0| 14/1 18/1 16/1| 9/2 37/2 39/2| 36/1 38/1 42/1| 11/3 39/3 38/3| 18/4 19/4 17/4| 14/5 20/5 22/5| 13/6 17/6 19/6| 18/7 22/7 23/7| 19/8 23/8 21/8| 15/9 21/9 20/9| 26/10 30/10 31/10| 28/1 32/1 34/1| 24/10 28/10 30/10| 25/10 29/10 28/10| 27/10 31/10 29/10| 35/11 63/11 61/11| 29/0 33/0 32/0| 31/6 35/6 33/6| 30/4 34/4 35/4| 8/12 10/12 38/12| 8/13 36/13 37/13| 40/4 42/4 43/4| 36/14 40/14 41/14| 37/6 41/6 43/6| 39/15 43/15 42/15| 52/16 56/16 57/16| 56/10 58/10 59/10| 53/17 57/17 59/17| 55/18 59/18 58/18| 54/19 58/19 56/19| 60/6 64/6 66/6| 34/11 62/11 63/11| 32/11 60/11 62/11| 33/11 61/11 60/11| 65/11 67/11 66/11| 61/4 65/4 64/4| 63/1 67/1 65/1| 62/0 66/0 67/0|
|
||||
palette:canon_1
|
||||
16/20 52/20 12/20| 23/21 25/21 21/21| 22/22 27/22 23/22| 20/23 26/23 22/23| 21/24 24/24 20/24| 17/25 54/25 16/25| 13/26 55/26 17/26| 12/27 53/27 13/27| 16/20 54/20 52/20| 23/21 27/21 25/21| 22/28 26/28 27/28| 20/23 24/23 26/23| 21/29 25/29 24/29| 17/25 55/25 54/25| 13/26 53/26 55/26| 12/27 52/27 53/27|
|
||||
palette:user_1
|
||||
4/30 8/30 0/30| 2/6 7/6 3/6| 6/11 5/11 7/11| 0/10 3/10 1/10| 4/1 1/1 5/1| 6/31 9/31 11/31| 6/32 10/32 4/32| 0/33 9/33 2/33| 4/30 10/30 8/30| 2/6 6/6 7/6| 6/11 4/11 5/11| 0/10 2/10 3/10| 4/1 0/1 1/1| 6/31 2/31 9/31| 6/32 11/32 10/32| 0/33 8/33 9/33|
|
||||
palette:bulding_base_1
|
||||
7/34 45/34 3/34| 45/10 48/10 44/10| 5/35 47/35 7/35| 3/36 44/36 1/36| 1/37 46/37 5/37| 48/0 51/0 50/0| 44/1 50/1 46/1| 47/6 49/6 45/6| 46/11 51/11 47/11| 7/34 47/34 45/34| 45/10 49/10 48/10| 5/35 46/35 47/35| 3/36 45/36 44/36| 1/37 44/37 46/37| 48/0 49/0 51/0| 44/1 48/1 50/1| 47/6 51/6 49/6| 46/11 50/11 51/11|
|
||||
|
||||
# Just for information:
|
||||
Palettes:bulding_base_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.014670 0.014670 0.014670
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:canon_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.000000 0.008711
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:canon_2
|
||||
Ns 323.999994
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.001354 0.800000 0.053320
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:user_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.113655 0.510074 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
77
samples/src/resources/resources/lowPoly/data/tree1.emf
Normal file
43
samples/src/resources/resources/lowPoly/data/tree2.emf
Normal file
@ -0,0 +1,43 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'tree2.blend'
|
||||
Mesh:Arbre_Normal_Mesh
|
||||
Vertex:72
|
||||
0.164861 0.283095 -0.182282|0.296594 0.102843 -0.182282|0.262285 -0.117765 -0.182282|0.082033 -0.249498 -0.182282|-0.140442 -0.257426 1.112208|-0.138575 -0.215189 -0.182282|-0.270308 -0.034936 -0.182282|-0.235999 0.185671 -0.182282|-0.055746 0.317404 -0.182282|0.004174 0.104880 0.626072|-0.070307 0.050448 0.626072|-0.084483 -0.040707 0.626072|-0.030051 -0.115188 0.626072|0.061105 -0.129365 0.626072|0.135585 -0.074932 0.626072|0.149762 0.016223 0.626072|0.095330 0.090704 0.626072|0.131783 0.228776 0.144384|0.234794 0.087823 0.144384|0.207966 -0.084686 0.144384|0.067013 -0.187698 0.144384|-0.105496 -0.160870 0.144384|-0.208508 -0.019917 0.144384|-0.181680 0.152592 0.144384|-0.040727 0.255604 0.144384|-0.233253 -0.213791 1.276952|0.796562 0.093071 2.045288|-0.079560 -0.072400 0.472328|0.263731 -0.671928 1.484988|-0.492027 -0.430949 1.858150|-0.464678 0.219195 1.688762|0.196689 0.558278 1.845816|0.752521 -0.090017 2.031457|0.039375 -0.591035 2.826299|-0.381645 -0.167964 3.106963|-0.175674 0.320591 3.129268|0.318578 0.203395 3.129268|0.522390 -0.403724 2.780408|0.049018 -0.132857 3.844571|-0.436419 -0.336556 1.061941|0.052607 -0.355632 0.624801|-0.185480 -0.768599 1.658063|0.534482 -0.253957 0.971040|0.397067 -0.064053 0.643590|-0.400966 0.185825 0.678289|-0.685105 -0.210238 2.072247|0.090083 0.282084 0.508441|-0.230477 0.532597 1.676011|0.554104 0.309080 1.745713|0.542760 -0.541603 2.117762|0.662662 -0.260909 2.386214|-0.201184 -0.545764 2.506993|0.173347 -0.652987 2.237929|-0.534110 -0.021396 2.510209|-0.465882 -0.318980 2.510209|-0.037923 0.443776 2.522092|-0.361786 0.320313 2.510694|0.640551 0.128032 2.510694|0.308340 0.396739 2.522089|0.385339 -0.589000 2.655612|-0.261979 -0.400722 3.209551|-0.303237 0.082070 3.212219|0.037654 0.366781 3.252412|0.460448 -0.099796 3.202400|0.057823 -0.406951 3.435973|0.341217 -0.296551 3.410657|-0.204117 -0.153493 3.645294|-0.097317 0.147076 3.663867|0.193195 0.078191 3.663867|0.499957 -1.411272 1.359687|0.317072 0.229824 1.921540|0.054495 0.984295 1.927069|
|
||||
Normal(face):118
|
||||
0.000000 -0.000000 -1.000000|-0.152617 -0.981339 0.116970|0.794618 0.580726 0.177029|0.972515 -0.151245 0.177029|0.580726 -0.794618 0.177030|-0.151245 -0.972515 0.177029|-0.794618 -0.580726 0.177030|-0.972515 0.151245 0.177029|0.151245 0.972515 0.177029|-0.580726 0.794618 0.177030|0.147398 0.947778 0.282827|0.976960 -0.151937 0.149879|0.586819 -0.802955 0.104437|-0.794264 -0.580467 0.179453|-0.956081 0.148689 0.252589|-0.563962 0.771680 0.294035|0.786787 0.575003 0.224362|-0.152618 -0.981339 0.116970|0.972515 -0.151245 0.177030|0.580726 -0.794618 0.177029|-0.151245 -0.972515 0.177030|-0.972515 0.151245 0.177030|-0.580726 0.794618 0.177029|0.976961 -0.151936 0.149879|-0.555364 -0.579988 -0.595974|0.457226 -0.792485 -0.403623|-0.698585 -0.392144 -0.598500|-0.361098 0.263925 -0.894400|0.338436 -0.066338 -0.938648|0.713955 -0.677917 -0.175204|-0.674831 -0.716762 0.175659|-0.857664 0.508498 0.076439|-0.110363 0.985539 0.128578|0.893993 0.448052 0.005014|0.306181 -0.950039 0.060654|-0.641707 -0.751181 0.154721|-0.891502 0.449505 0.056301|0.131612 0.968867 0.209701|0.971478 -0.020385 0.236253|0.144704 -0.948441 0.281992|-0.895095 -0.326221 0.303949|-0.799039 0.527619 0.288365|0.576149 0.755431 0.312051|0.922569 -0.235898 0.305319|-0.770834 -0.624081 -0.127823|-0.405608 -0.812724 -0.418286|0.062587 -0.931647 -0.357934|0.933424 0.271984 -0.233976|0.544543 -0.605934 -0.579928|0.324692 -0.326377 -0.887724|-0.911698 0.404706 -0.070849|-0.968964 -0.100206 -0.225981|-0.803705 -0.581730 -0.125098|0.022211 0.978740 -0.203900|-0.275219 0.921710 -0.273324|-0.800436 0.595302 -0.070128|0.926984 0.294829 -0.231899|0.768782 0.564439 -0.300637|0.518155 0.828492 -0.212404|0.861560 -0.491080 0.128665|0.943484 -0.319788 -0.087027|0.808719 -0.583250 -0.076115|-0.243949 -0.968675 0.046448|-0.095389 -0.963255 0.251080|0.229197 -0.971992 0.051965|-0.956844 -0.219379 0.190583|-0.894652 -0.205120 0.396892|-0.666071 -0.730216 0.152097|-0.357453 0.927766 0.107131|-0.356011 0.917500 0.177341|-0.800245 0.599089 0.026474|0.616860 0.752916 0.229350|0.627266 0.770777 0.111535|0.587125 0.803892 0.095090|0.064549 -0.990791 0.119021|0.288718 -0.957414 0.000133|0.739582 -0.654059 0.158827|-0.903564 -0.367352 0.220508|-0.646653 -0.756180 0.100155|-0.378320 -0.912496 0.155646|-0.816738 0.522177 0.245500|-0.870792 0.438826 0.221705|-0.942523 0.175999 0.284032|0.564843 0.789002 0.241718|0.134056 0.986863 0.090168|-0.280573 0.951083 0.129303|0.945324 -0.182563 0.270246|0.969312 -0.023224 0.244736|0.807100 0.465318 0.363411|0.348922 -0.774768 0.527246|0.366741 -0.860105 0.354572|0.655280 -0.690710 0.305823|-0.343921 -0.783210 0.517978|-0.366167 -0.787647 0.495513|-0.222040 -0.931538 0.287986|-0.617951 0.172171 0.767133|-0.885349 0.292244 0.361594|-0.937867 0.165784 0.304829|0.139289 0.587426 0.797201|0.198256 0.836106 0.511490|-0.380275 0.861884 0.335479|0.816006 -0.065729 0.574295|0.866067 0.004307 0.499910|0.832741 0.462919 0.303724|
|
||||
Face:118
|
||||
palette:trunk_1
|
||||
3/0 6/0 8/0| 20/1 12/1 21/1| 17/2 1/2 0/2| 18/3 2/3 1/3| 19/4 3/4 2/4| 20/5 5/5 3/5| 21/6 6/6 5/6| 22/7 7/7 6/7| 24/8 0/8 8/8| 23/9 8/9 7/9| 17/10 9/10 16/10| 19/11 15/11 14/11| 20/12 14/12 13/12| 21/13 11/13 22/13| 22/14 10/14 23/14| 23/15 9/15 24/15| 18/16 16/16 15/16| 8/0 0/0 3/0| 0/0 1/0 3/0| 1/0 2/0 3/0| 3/0 5/0 6/0| 6/0 7/0 8/0| 20/17 13/17 12/17| 17/2 18/2 1/2| 18/18 19/18 2/18| 19/19 20/19 3/19| 20/20 21/20 5/20| 21/6 22/6 6/6| 22/21 23/21 7/21| 24/8 17/8 0/8| 23/22 24/22 8/22| 17/10 24/10 9/10| 19/23 18/23 15/23| 20/12 19/12 14/12| 21/13 12/13 11/13| 22/14 11/14 10/14| 23/15 10/15 9/15| 18/16 17/16 16/16|
|
||||
palette:leaf_1
|
||||
27/24 40/24 39/24| 28/25 40/25 42/25| 27/26 39/26 44/26| 27/27 44/27 46/27| 27/28 46/28 43/28| 28/29 42/29 49/29| 29/30 41/30 51/30| 30/31 45/31 53/31| 31/32 47/32 55/32| 32/33 48/33 57/33| 28/34 49/34 52/34| 29/35 51/35 54/35| 30/36 53/36 56/36| 31/37 55/37 58/37| 32/38 57/38 50/38| 33/39 59/39 64/39| 34/40 60/40 66/40| 35/41 61/41 67/41| 36/42 62/42 68/42| 37/43 63/43 65/43| 39/44 41/44 29/44| 39/45 40/45 41/45| 40/46 28/46 41/46| 42/47 43/47 32/47| 42/48 40/48 43/48| 40/49 27/49 43/49| 44/50 45/50 30/50| 44/51 39/51 45/51| 39/52 29/52 45/52| 46/53 47/53 31/53| 46/54 44/54 47/54| 44/55 30/55 47/55| 43/56 48/56 32/56| 43/57 46/57 48/57| 46/58 31/58 48/58| 49/59 50/59 37/59| 49/60 42/60 50/60| 42/61 32/61 50/61| 51/62 52/62 33/62| 51/63 41/63 52/63| 41/64 28/64 52/64| 53/65 54/65 34/65| 53/66 45/66 54/66| 45/67 29/67 54/67| 55/68 56/68 35/68| 55/69 47/69 56/69| 47/70 30/70 56/70| 57/71 58/71 36/71| 57/72 48/72 58/72| 48/73 31/73 58/73| 52/74 59/74 33/74| 52/75 49/75 59/75| 49/76 37/76 59/76| 54/77 60/77 34/77| 54/78 51/78 60/78| 51/79 33/79 60/79| 56/80 61/80 35/80| 56/81 53/81 61/81| 53/82 34/82 61/82| 58/83 62/83 36/83| 58/84 55/84 62/84| 55/85 35/85 62/85| 50/86 63/86 37/86| 50/87 57/87 63/87| 57/88 36/88 63/88| 64/89 65/89 38/89| 64/90 59/90 65/90| 59/91 37/91 65/91| 66/92 64/92 38/92| 66/93 60/93 64/93| 60/94 33/94 64/94| 67/95 66/95 38/95| 67/96 61/96 66/96| 61/97 34/97 66/97| 68/98 67/98 38/98| 68/99 62/99 67/99| 62/100 35/100 67/100| 65/101 68/101 38/101| 65/102 63/102 68/102| 63/103 36/103 68/103|
|
||||
Physics:
|
||||
Cylinder
|
||||
radius:0.25
|
||||
size:2.0
|
||||
origin:0.0117903 0.0311268 0.962411
|
||||
mass:6.25
|
||||
Sphere
|
||||
radius:1.3350000381469727
|
||||
origin:-0.093534 -0.0233787 2.81849
|
||||
mass:237.92705789594712
|
||||
|
||||
# Just for information:
|
||||
Palettes:leaf_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.346704 0.558341 0.090842
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:trunk_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.057805 0.039546 0.013702
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
BIN
samples/src/resources/resources/lowPoly/simple3D.blend
Normal file
BIN
samples/src/resources/resources/lowPoly/tree2.blend
Normal file
@ -0,0 +1,32 @@
|
||||
<Composer>
|
||||
<Sizer mode="VERTICAL" lock="true" fill="true" expand="true">
|
||||
<Label name="[{ID}]file-chooser:title-label">_T{Change height map}</Label>
|
||||
<Sizer mode="HORIZONTAL" lock="true" expand="true,false,false">
|
||||
<Image src="width.svg" expand="false" image-size="48,48px"/>
|
||||
<Spacer min-size="2,2mm"/>
|
||||
<Slider name="[{ID}]HeighMap:slider-width"
|
||||
expand="true,false"
|
||||
fill="true,false"
|
||||
minimum="0.1"
|
||||
maximum="40" />
|
||||
</Sizer>
|
||||
<Sizer mode="HORIZONTAL" lock="true" expand="true,false,false">
|
||||
<Image src="top.svg" expand="false" image-size="48,48px"/>
|
||||
<Spacer min-size="2,2mm"/>
|
||||
<Slider name="[{ID}]HeighMap:slider-top"
|
||||
expand="true,false"
|
||||
fill="true,false"
|
||||
minimum="-128"
|
||||
maximum="128" />
|
||||
</Sizer>
|
||||
<Sizer mode="HORIZONTAL" lock="true" expand="true,false,false">
|
||||
<Image src="bottom.svg" expand="false" image-size="48,48px"/>
|
||||
<Spacer min-size="2,2mm"/>
|
||||
<Slider name="[{ID}]HeighMap:slider-bottom"
|
||||
expand="true,false"
|
||||
fill="true,false"
|
||||
minimum="-128"
|
||||
maximum="128"/>
|
||||
</Sizer>
|
||||
</Sizer>
|
||||
</Composer>
|
@ -6,8 +6,8 @@ precision mediump int;
|
||||
#endif
|
||||
|
||||
// Input:
|
||||
in vec3 in_position;
|
||||
in vec2 in_textureCoords;
|
||||
layout (location = 0) in vec3 in_position;
|
||||
layout (location = 1) in vec2 in_textureCoords;
|
||||
uniform mat4 in_matrixTransformation;
|
||||
uniform mat4 in_matrixProjection;
|
||||
uniform mat4 in_matrixView;
|
@ -0,0 +1,87 @@
|
||||
#version 400 core
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
struct Light {
|
||||
vec3 color;
|
||||
vec3 position;
|
||||
vec3 attenuation;
|
||||
};
|
||||
|
||||
|
||||
const int MAX_LIGHT_NUMBER = 8;
|
||||
|
||||
|
||||
in vec2 io_textureCoords;
|
||||
in vec3 io_surfaceNormal;
|
||||
in vec3 io_toCameraVector;
|
||||
in vec3 io_toLightVector[MAX_LIGHT_NUMBER];
|
||||
// FOW: Fog Of War result calculation
|
||||
in float io_fowVisibility;
|
||||
|
||||
// texture properties
|
||||
uniform sampler2D in_textureBase;
|
||||
// Material
|
||||
//uniform Material in_material;
|
||||
// 2 light for suns and other for locals ...
|
||||
uniform Light in_lights[MAX_LIGHT_NUMBER];
|
||||
// global color of the sky ... needed to have a better color for the FOW
|
||||
//uniform vec3 in_sky_color;
|
||||
const vec3 in_sky_color = vec3(1.0,1.0,1.0);
|
||||
|
||||
// output:
|
||||
out vec4 out_Color;
|
||||
|
||||
void main(void) {
|
||||
// disable transparency elements in the texture ...
|
||||
// Can be set at the start of the shader ...
|
||||
/*
|
||||
vec4 textureColour = texture(in_textureBase, io_textureCoords);
|
||||
if (textureColour.a < 0.5) {
|
||||
discard;
|
||||
}
|
||||
*/
|
||||
//vec4 textureColour = vec4(1.0,1.0,1.0,1.0);
|
||||
// keep material:
|
||||
vec3 tex_ambientFactor = texture(in_textureBase, vec2(io_textureCoords.x, 4.5/8.0)).xyz;
|
||||
//vec3 tex_diffuseFactor = texture(in_textureBase, vec2(io_textureCoords.x, 0.5/8.0)).xyz;
|
||||
//vec4 textureColour = texture(in_textureBase, vec2(io_textureCoords.x, 0.5/8.0));
|
||||
vec4 textureColour = texture(in_textureBase, io_textureCoords);
|
||||
vec3 tex_specularFactor = texture(in_textureBase, vec2(io_textureCoords.x, 2.5/8.0)).xyz;
|
||||
float tex_shininess = texture(in_textureBase, vec2(io_textureCoords.x, 6.5/8.0)).x;
|
||||
|
||||
vec3 unitNormal = normalize(io_surfaceNormal);
|
||||
vec3 unitVectorToCamera = normalize(io_toCameraVector);
|
||||
vec3 totalDiffuse = vec3(0.0);
|
||||
vec3 totalSpecular = vec3(0.0);
|
||||
for(int iii=0; iii<MAX_LIGHT_NUMBER; iii++) {
|
||||
float distance = length(io_toLightVector[iii]);
|
||||
float attenuationFactor = in_lights[iii].attenuation.x + (in_lights[iii].attenuation.y * distance) + (in_lights[iii].attenuation.z * distance * distance);
|
||||
vec3 unitLightVector = normalize(io_toLightVector[iii]);
|
||||
float nDot1 = dot(unitNormal, unitLightVector);
|
||||
float brightness = max(nDot1, 0.0);
|
||||
vec3 lightDirection = -unitLightVector;
|
||||
vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);
|
||||
float specularFactor = dot(reflectedLightDirection, unitVectorToCamera);
|
||||
specularFactor = max(specularFactor, 0.0);
|
||||
float damperFactor = pow(specularFactor, tex_shininess);
|
||||
vec3 diffuse = (brightness * in_lights[iii].color) / attenuationFactor;
|
||||
vec3 finalSpecular = (damperFactor * tex_specularFactor.x * in_lights[iii].color) / attenuationFactor; // TODO: Remove the x ....
|
||||
totalDiffuse = totalDiffuse + diffuse;
|
||||
totalSpecular = totalSpecular + finalSpecular;
|
||||
}
|
||||
// the 0.2 represent the ambiant lightning ==> maybe set an uniform for this
|
||||
//totalDiffuse = max(totalDiffuse, 1.0);
|
||||
//totalDiffuse = min(totalDiffuse, 0.4);
|
||||
|
||||
//////out_Color = vec4(totalDiffuse,1.0) * textureColour + vec4(totalSpecular, 1.0);
|
||||
out_Color = (vec4(totalDiffuse,1.0)*0.5+0.5) * textureColour;
|
||||
/////out_Color = mix(vec4(in_sky_color,1.0), out_Color, io_fowVisibility);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
#version 400 core
|
||||
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
struct Light {
|
||||
vec3 color;
|
||||
vec3 position;
|
||||
vec3 attenuation;
|
||||
};
|
||||
const int MAX_LIGHT_NUMBER = 8;
|
||||
|
||||
// Input:
|
||||
layout (location = 0) in vec3 in_position;
|
||||
layout (location = 1) in vec2 in_textureCoords;
|
||||
layout (location = 2) in vec3 in_normal;
|
||||
// 2 light for suns and other for locals ...
|
||||
uniform Light in_lights[MAX_LIGHT_NUMBER];
|
||||
|
||||
uniform mat4 in_matrixTransformation;
|
||||
uniform mat4 in_matrixProjection;
|
||||
uniform mat4 in_matrixView;
|
||||
|
||||
//uniform float in_numberOfRows;
|
||||
//uniform vec2 in_offset;
|
||||
const float in_numberOfRows = 1;
|
||||
const vec2 in_offset = vec2(0.0,0.0);
|
||||
|
||||
// Configuration of the FOV ==> TODO: Set it in parameter uniform ...
|
||||
const float c_density = 0.007;
|
||||
const float c_gradient = 1.5;
|
||||
|
||||
// output:
|
||||
out vec2 io_textureCoords;
|
||||
out vec3 io_surfaceNormal;
|
||||
out vec3 io_toCameraVector;
|
||||
out vec3 io_toLightVector[MAX_LIGHT_NUMBER];
|
||||
// FOW: Fog Of War result calculation
|
||||
out float io_fowVisibility;
|
||||
|
||||
void main(void) {
|
||||
vec4 worldPosition = in_matrixTransformation * vec4(in_position, 1.0);
|
||||
vec4 positionRelativeToCam = in_matrixView * worldPosition;
|
||||
gl_Position = in_matrixProjection * positionRelativeToCam;
|
||||
io_textureCoords = (in_textureCoords/in_numberOfRows) + in_offset;
|
||||
|
||||
io_surfaceNormal = (in_matrixTransformation * vec4(in_normal, 0.0)).xyz;
|
||||
for(int iii=0;iii<MAX_LIGHT_NUMBER;iii++) {
|
||||
io_toLightVector[iii] = in_lights[iii].position - worldPosition.xyz;
|
||||
}
|
||||
io_toCameraVector = (inverse(in_matrixView) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz;
|
||||
|
||||
float distance = length(positionRelativeToCam.xyz);
|
||||
|
||||
io_fowVisibility = exp(-pow((distance*c_density),c_gradient));
|
||||
io_fowVisibility = clamp(io_fowVisibility, 0.0, 1.0);
|
||||
}
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
46
samples/src/resources/resources/mapFactory/data/cube-one.obj
Normal file
@ -0,0 +1,46 @@
|
||||
# Blender v2.82 (sub 7) OBJ File: 'cube.blend'
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v 0.5 0.5 -0.5
|
||||
v 0.5 -0.5 -0.5
|
||||
v 0.5 0.5 0.5
|
||||
v 0.5 -0.5 0.5
|
||||
v -0.5 0.5 -0.5
|
||||
v -0.5 -0.5 -0.5
|
||||
v -0.5 0.5 0.5
|
||||
v -0.5 -0.5 0.5
|
||||
vt 0.875000 0.500000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.625000 0.500000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.375000 0.750000
|
||||
vt 0.625000 0.000000
|
||||
vt 0.375000 0.250000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.375000 0.500000
|
||||
vt 0.125000 0.750000
|
||||
vt 0.125000 0.500000
|
||||
vt 0.625000 0.250000
|
||||
vt 0.875000 0.750000
|
||||
vt 0.625000 1.000000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
usemtl Material
|
||||
s off
|
||||
f 5/1/1 3/2/1 1/3/1
|
||||
f 3/2/2 8/4/2 4/5/2
|
||||
f 7/6/3 6/7/3 8/8/3
|
||||
f 2/9/4 8/10/4 6/11/4
|
||||
f 1/3/5 4/5/5 2/9/5
|
||||
f 5/12/6 2/9/6 6/7/6
|
||||
f 5/1/1 7/13/1 3/2/1
|
||||
f 3/2/2 7/14/2 8/4/2
|
||||
f 7/6/3 5/12/3 6/7/3
|
||||
f 2/9/4 4/5/4 8/10/4
|
||||
f 1/3/5 3/2/5 4/5/5
|
||||
f 5/12/6 1/3/6 2/9/6
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"default": {
|
||||
"Ns":225.000000,
|
||||
"Ka":"1.000000 1.000000 1.000000",
|
||||
"Kd":"0.346704 0.558341 0.090842",
|
||||
"Ks":"0.500000 0.500000 0.500000",
|
||||
"Ke":"0.000000 0.000000 0.000000",
|
||||
"vNi":1.000000,
|
||||
"d":1.000000,
|
||||
"illum":2
|
||||
},
|
||||
"palette": {
|
||||
"leaf_1":{
|
||||
"Kd":"0.346704 0.558341 0.090842"
|
||||
},
|
||||
"leaf_2":{
|
||||
"Kd":"0.278894 0.278894 0.023153"
|
||||
},
|
||||
"leaf_3":{
|
||||
"Kd":"0.800000 0.800000 0.800000"
|
||||
},
|
||||
"trunk_1":{
|
||||
"Kd":"0.25 0.13 0.07"
|
||||
},
|
||||
"trunk_2":{
|
||||
"Kd":"0.057805 0.039546 0.013702"
|
||||
},
|
||||
"grass_1":{
|
||||
"Kd":"0.057805 1.0 0.013702"
|
||||
},
|
||||
"grass_2":{
|
||||
"Kd":"1.0 0.0 0.013702"
|
||||
},
|
||||
"grass_3":{
|
||||
"Kd":"1.0 1.0 0.013702"
|
||||
},
|
||||
"grass_4":{
|
||||
"Kd":"0.0 0.0 1.0"
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 517 KiB After Width: | Height: | Size: 517 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
46
samples/src/resources/resources/res/cube-one.obj
Normal file
@ -0,0 +1,46 @@
|
||||
# Blender v2.82 (sub 7) OBJ File: 'cube.blend'
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v 0.5 0.5 -0.5
|
||||
v 0.5 -0.5 -0.5
|
||||
v 0.5 0.5 0.5
|
||||
v 0.5 -0.5 0.5
|
||||
v -0.5 0.5 -0.5
|
||||
v -0.5 -0.5 -0.5
|
||||
v -0.5 0.5 0.5
|
||||
v -0.5 -0.5 0.5
|
||||
vt 0.875000 0.500000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.625000 0.500000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.375000 0.750000
|
||||
vt 0.625000 0.000000
|
||||
vt 0.375000 0.250000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.375000 0.500000
|
||||
vt 0.125000 0.750000
|
||||
vt 0.125000 0.500000
|
||||
vt 0.625000 0.250000
|
||||
vt 0.875000 0.750000
|
||||
vt 0.625000 1.000000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
usemtl Material
|
||||
s off
|
||||
f 5/1/1 3/2/1 1/3/1
|
||||
f 3/2/2 8/4/2 4/5/2
|
||||
f 7/6/3 6/7/3 8/8/3
|
||||
f 2/9/4 8/10/4 6/11/4
|
||||
f 1/3/5 4/5/5 2/9/5
|
||||
f 5/12/6 2/9/6 6/7/6
|
||||
f 5/1/1 7/13/1 3/2/1
|
||||
f 3/2/2 7/14/2 8/4/2
|
||||
f 7/6/3 5/12/3 6/7/3
|
||||
f 2/9/4 4/5/4 8/10/4
|
||||
f 1/3/5 3/2/5 4/5/5
|
||||
f 5/12/6 1/3/6 2/9/6
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 577 KiB After Width: | Height: | Size: 577 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
BIN
samples/src/resources/resources/res/grass.png
Normal file
After Width: | Height: | Size: 182 KiB |
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 159 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 426 KiB After Width: | Height: | Size: 426 KiB |
Before Width: | Height: | Size: 474 KiB After Width: | Height: | Size: 474 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 991 KiB After Width: | Height: | Size: 991 KiB |
Before Width: | Height: | Size: 938 KiB After Width: | Height: | Size: 938 KiB |
Before Width: | Height: | Size: 1003 KiB After Width: | Height: | Size: 1003 KiB |
Before Width: | Height: | Size: 342 KiB After Width: | Height: | Size: 342 KiB |