Merge remote-tracking branch 'origin/dev'

Conflicts:
	README.md
	sources/tag
This commit is contained in:
Edouard DUPIN 2015-04-21 23:38:08 +02:00
commit db4fa5147e
177 changed files with 2655 additions and 1864 deletions

65
.gitmodules vendored
View File

@ -2,30 +2,18 @@
[submodule "external/glew/glew"]
path = external/glew/glew
url = https://github.com/HeeroYui/glew.git
[submodule "build"]
path = build
url = https://github.com/HeeroYui/Build.git
[submodule "external/etk"]
path = external/etk
url = https://github.com/HeeroYui/etk.git
[submodule "external/agg"]
path = external/agg
url = https://github.com/HeeroYui/libagg.git
[submodule "external/portaudio"]
path = external/portaudio
url = https://github.com/HeeroYui/libportaudio.git
[submodule "external/freetype"]
path = external/freetype
url = https://github.com/HeeroYui/libfreetype.git
[submodule "external/png"]
path = external/png
url = https://github.com/HeeroYui/libpng.git
[submodule "external/ogg"]
path = external/ogg
url = https://github.com/HeeroYui/libogg.git
[submodule "external/lua"]
path = external/lua
url = https://github.com/HeeroYui/liblua.git
[submodule "external/z/zlib"]
path = external/z/zlib
url = https://github.com/madler/zlib.git
@ -47,24 +35,47 @@
[submodule "external/ege"]
path = external/ege
url = https://github.com/HeeroYui/ege.git
[submodule "monk"]
path = monk
url = https://github.com/HeeroYui/monk.git
[submodule "external/rtaudio/rtaudio"]
path = external/rtaudio/rtaudio
url = https://github.com/HeeroYui/rtaudio.git
[submodule "external/eaudiofx"]
path = external/eaudiofx
url = https://github.com/HeeroYui/eaudiofx.git
[submodule "external/airtaudio"]
path = external/airtaudio
url = https://github.com/HeeroYui/AirTAudio.git
[submodule "external/ewolsa"]
path = external/ewolsa
url = https://github.com/HeeroYui/ewolsa.git
[submodule "ios-deploy"]
path = ios-deploy
url = https://github.com/HeeroYui/ios-deploy.git
[submodule "external/enet"]
path = external/enet
url = https://github.com/HeeroYui/enet.git
[submodule "external/gtest"]
path = external/gtest
url = https://github.com/HeeroYui/gtest
[submodule "external/audio-ess"]
path = external/audio-ess
url = https://github.com/HeeroYui/audio-ess.git
[submodule "external/audio-blockEngine"]
path = external/audio-blockEngine
url = https://github.com/HeeroYui/audio-blockEngine.git
[submodule "external/ogg"]
path = external/ogg
url = https://github.com/musicdsp/ogg.git
[submodule "external/speex"]
path = external/speex
url = https://github.com/musicdsp/speex.git
[submodule "external/speexdsp"]
path = external/speexdsp
url = https://github.com/musicdsp/speexdsp.git
[submodule "external/audio"]
path = external/audio
url = https://github.com/musicdsp/audio.git
[submodule "external/audio-algo-aec"]
path = external/audio-algo-aec
url = https://github.com/musicdsp/audio-algo-aec.git
[submodule "external/audio-algo-drain"]
path = external/audio-algo-drain
url = https://github.com/musicdsp/audio-algo-drain.git
[submodule "external/audio-drain"]
path = external/audio-drain
url = https://github.com/musicdsp/audio-drain.git
[submodule "external/audio-river"]
path = external/audio-river
url = https://github.com/musicdsp/audio-river.git
[submodule "external/audio-orchestra"]
path = external/audio-orchestra
url = https://github.com/musicdsp/audio-orchestra.git

View File

@ -1,5 +1,7 @@
# language type:
language: cpp
language:
- cpp
- Objective-c
# compilator system:
compiler:
@ -14,29 +16,26 @@ branches:
# previous actions:
before_script:
- git clone git://github.com/HeeroYui/lutin.git
- git submodule init
- git submodule update
- if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi
install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update -qq
- sudo apt-get install -qq g++-4.8
- sudo apt-get install -qq libstdc++-4.9-dev
- sudo apt-get install -qq g++-4.9
- sudo rm /usr/bin/gcc /usr/bin/g++
- sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
- sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
- sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc
- sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++
# build sequence with Lutin :
script:
- if [ "$CXX" == "clang++" ]; then ./build/lutin.py -C -P -cclang -mdebug -p ewol etktest exmltest ejsontest enettest; fi
- if [ "$CXX" == "g++" ]; then ./build/lutin.py -C -P -cgcc -mdebug -p ewol etktest exmltest ejsontest enettest; fi
after_script:
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/etktest/usr/bin/etktest; fi
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/exmltest/usr/bin/exmltest; fi
- if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/ejsontest/usr/bin/ejsontest; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/etktest/usr/bin/etktest; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/exmltest/usr/bin/exmltest; fi
- if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/ejsontest/usr/bin/ejsontest; fi
- ./lutin/lutin.py -C -P -c$BUILDER -mdebug -p ewol etk_test exml_test ejson_test enettest
- ./out/Linux_x86_64/debug/staging/$BUILDER/etk_test/usr/bin/etk_test
- ./out/Linux_x86_64/debug/staging/$BUILDER/ejson_test/usr/bin/ejson_test
- ./out/Linux_x86_64/debug/staging/$BUILDER/exml_test/usr/bin/exml_test
#send e-mail on compilation result:
notifications:

View File

@ -10,6 +10,7 @@ Instructions
download the software :
git clone git://github.com/HeeroYui/lutin.git
git clone git://github.com/HeeroYui/ewol.git
cd ewol
git submodule init

View File

@ -1,218 +0,0 @@
# add this folder in ~/.config/blender/2.66/scripts/addons
bl_info = {
"name": "Ewol Mesh file format emf",
"author": "Edouard DUPIN",
"blender": (2, 53, 0),
"location": "File > Import-Export",
"description": "Import-Export emf, Import EMF mesh, UV's, materials and textures",
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/EwolMechFile_EMF",
"tracker_url": "",
"support": 'OFFICIAL',
"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 (ExportHelper,
ImportHelper,
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'},
)
axis_forward = EnumProperty(
name="Forward",
items=(('X', "X Forward", ""),
('Y', "Y Forward", ""),
('Z', "Z Forward", ""),
('-X', "-X Forward", ""),
('-Y', "-Y Forward", ""),
('-Z', "-Z Forward", ""),
),
default='-X',
)
axis_up = EnumProperty(
name="Up",
items=(('X', "X Up", ""),
('Y', "Y Up", ""),
('Z', "Z Up", ""),
('-X', "-X Up", ""),
('-Y', "-Y Up", ""),
('-Z', "-Z Up", ""),
),
default='Z',
)
def execute(self, context):
# print("Selected: " + context.active_object.name)
from . import import_obj
keywords = self.as_keywords(ignore=("axis_forward",
"axis_up",
"filter_glob",
"split_mode",
))
global_matrix = axis_conversion(from_forward=self.axis_forward,
from_up=self.axis_up,
).to_4x4()
keywords["global_matrix"] = global_matrix
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, "axis_forward")
layout.prop(self, "axis_up")
layout.prop(self, "use_image_search")
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 filein 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"
)
axis_forward = EnumProperty(
name="Forward",
items=(('X', "X Forward", ""),
('Y', "Y Forward", ""),
('Z', "Z Forward", ""),
('-X', "-X Forward", ""),
('-Y', "-Y Forward", ""),
('-Z', "-Z Forward", ""),
),
default='-Z',
)
axis_up = EnumProperty(
name="Up",
items=(('X', "X Up", ""),
('Y', "Y Up", ""),
('Z', "Z Up", ""),
('-X', "-X Up", ""),
('-Y', "-Y Up", ""),
('-Z', "-Z Up", ""),
),
default='Y',
)
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=("axis_forward",
"axis_up",
"global_scale",
"check_existing",
"filter_glob",
))
global_matrix = Matrix()
global_matrix[0][0] = \
global_matrix[1][1] = \
global_matrix[2][2] = self.global_scale
global_matrix = (global_matrix *
axis_conversion(to_forward=self.axis_forward,
to_up=self.axis_up,
).to_4x4())
keywords["global_matrix"] = global_matrix
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)")
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_file_import.append(menu_func_import)
bpy.types.INFO_MT_file_export.append(menu_func_export)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_file_import.remove(menu_func_import)
bpy.types.INFO_MT_file_export.remove(menu_func_export)
if __name__ == "__main__":
register()

View File

@ -1,661 +0,0 @@
import os
import time
import bpy
import mathutils
import bpy_extras.io_utils
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)
"""
# Methods for writing point, scale, and quaternion types to a YAML file.
# This particular implementation converts values to a Y-up coordinate system.
def out_point3_y_up( v ):
return "%g %g %g" % ( v.x, v.z, -v.y )
def out_scale3_y_up( s ):
return "%g %g %g" % ( s.x, s.z, s.y )
def out_quaternion_y_up( q ):
return "%g %g %g %g" % ( q.w, q.x, q.z, -q.y )
# This implementation maintains blender's Z-up coordinate system.
def out_point3_z_up( v ):
return "%g %g %g" % ( v.x, v.y, v.z )
def out_scale3_z_up( s ):
return "%g %g %g" % ( s.x, s.y, s.z )
def out_quaternion_z_up( q ):
return "%g %g %g %g" % ( q.w, q.x, q.y, q.z )
def getPhysicsShape(obj, mainObjScale, use_y_up=False):
shape = ""
props = { }
name = obj.name.lower()
scale = Vector(( abs(obj.scale.x), abs(obj.scale.y), abs(obj.scale.z) ))
if use_y_up:
out_point3 = out_point3_y_up
out_scale3 = out_scale3_y_up
out_quaternion = out_quaternion_y_up
else:
out_point3 = out_point3_z_up
out_scale3 = out_scale3_z_up
out_quaternion = out_quaternion_z_up
# 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
props["height"] = obj.scale.z * 2.0
# CYLINDER
elif name.startswith('cyl'):
shape = "Cylinder"
props["half-extents"] = out_scale3( scale )
# CAPSULE
elif name.startswith('cap'):
shape = "Capsule"
props["radius"] = obj.scale.x
props["height"] = obj.scale.z
# CONVEX-HULL
elif name.startswith('convex'):
shape = "ConvexHull"
mesh = obj.to_mesh( bpy.context.scene, True, 'PREVIEW' )
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 : '%s' from element name : '%s'" % (shape, obj.name))
if obj.location != Vector((0,0,0)):
props["origin"] = out_point3( obj.location )
if obj.rotation_mode == 'QUATERNION':
qrot = obj.rotation_quaternion
else:
qrot = obj.matrix_local.to_quaternion()
if qrot != Quaternion((1,0,0,0)):
props["rotate"] = out_quaternion( qrot )
return (shape, props)
def writeCollisionShape(object, file, mainObjScale):
if len(getChildren(object))==0:
# no phisical shape ...
return
fw = file.write
fw('\t\tPhysics : \n')
for subObj in getChildren(object):
print(" element='%s' type '%s'" % (subObj.name,str(subObj.type)))
if subObj.type != 'MESH':
continue
(shape, props) = getPhysicsShape(subObj, mainObjScale)
if shape=="":
print("error of shape detection type ...");
continue
fw("\t\t\t" + shape + "\n" )
for (k,v) in props.items():
fw("\t\t\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:
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)
fw = file.write
fw('\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 :)
fw('\t%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
fw('\t\tNs %.6f\n' % tspec)
del tspec
fw('\t\tKa %.6f %.6f %.6f\n' % (mat.ambient * world_amb)[:]) # Ambient, uses mirror color,
fw('\t\tKd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:]) # Diffuse
fw('\t\tKs %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:]) # Specular
if hasattr(mat, "ior"):
fw('\t\tNi %.6f\n' % mat.ior) # Refraction index
else:
fw('\t\tNi %.6f\n' % 1.0)
fw('\t\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:
fw('\t\tillum 0\n') # ignore lighting
elif mat.specular_intensity == 0:
fw('\t\tillum 1\n') # no specular.
else:
fw('\t\tillum 2\n') # light normaly
else:
#write a dummy material here?
fw('\t\tNs 0\n')
fw('\t\tKa %.6f %.6f %.6f\n' % world_amb[:]) # Ambient, uses mirror color,
fw('\t\tKd 0.8 0.8 0.8\n')
fw('\t\tKs 0.8 0.8 0.8\n')
fw('\t\td 1\n') # No alpha
fw('\t\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)
fw('\t\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)
fw('\t\t%s %s\n' % (key, repr(filepath)[1:-1]))
"""
" @brief Basic write function. The context and options must be already set.
"""
def write_file(filepath,
objects,
scene,
EXPORT_GLOBAL_MATRIX=None,
EXPORT_PATH_MODE='AUTO',
EXPORT_BINARY_MODE=False,
EXPORT_COLLISION_NAME=""
):
if EXPORT_GLOBAL_MATRIX is None:
EXPORT_GLOBAL_MATRIX = mathutils.Matrix()
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)
print('EMF Export path: %r' % filepath)
time1 = time.time()
mtlfilepath = os.path.splitext(filepath)[0] + ".mtl"
file = open(filepath, "w", encoding="utf8", newline="\n")
fw = file.write
# Write Header
fw('EMF(STRING)\n') # if binary : fw('EMF(BINARY)\n')
fw('# Blender v%s EMF File: %r\n' % (bpy.app.version_string, os.path.basename(bpy.data.filepath)))
# Initialize totals, these are updated each object
totverts = totuvco = totno = 1
face_vert_index = 1
globalNormals = {}
# A Dict of Materials
# (material.name, image.name):matname_imagename # matname_imagename has gaps removed.
mtl_dict = {}
# 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 = {}
copy_set = set()
# Get all meshes
for ob_main in objects:
print("**************** '%s' *******************" % str(ob_main.name))
if ob_main.type != 'MESH':
print(ob_main.name, 'is not a mesh type - ignoring')
fw('# can not export : "%s" : type="%s"\n' % (ob_main.name, str(ob_main.type)))
continue
#print("name : '%s'" % ob_main.name)
#for plop in ob_main.child:
# print(" child : '%s'" % plop.name)
# ignore dupli children
if ob_main.parent and ob_main.parent.dupli_type in {'VERTS', 'FACES'}:
# XXX
print(ob_main.name, 'is a dupli child - ignoring')
continue
obs = []
if ob_main.dupli_type != 'NONE':
# XXX
print('creating dupli_list on', ob_main.name)
ob_main.dupli_list_create(scene)
obs = [(dob.object, dob.matrix) for dob in ob_main.dupli_list]
# XXX debug print
print(ob_main.name, 'has', len(obs), 'dupli children')
else:
obs = [(ob_main, ob_main.matrix_world)]
idMesh=0
for ob, ob_mat in obs:
try:
# apply the mesh modifieur at the curent object :
me = ob.to_mesh(scene, True, 'PREVIEW', calc_tessface=False)
except RuntimeError:
me = None
if me is None:
continue
idMesh = idMesh+1;
fw('Mesh : %d\n' % idMesh)
me.transform(EXPORT_GLOBAL_MATRIX * ob_mat)
#print("ploppp : " + str(EXPORT_GLOBAL_MATRIX) )
#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 ....
if True:
name1 = ob.name
name2 = ob.data.name
if name1 == name2:
obnamestring = name_compat(name1)
else:
obnamestring = '%s_%s' % (name_compat(name1), name_compat(name2))
fw('\t%s\n' % obnamestring) # Write Object name
###########################################################
## Vert
###########################################################
fw('\t\tVertex : %d\n\t\t\t' % len(me_verts))
for v in me_verts:
fw('%.6f %.6f %.6f|' % v.co[:])
fw('\n')
###########################################################
## UV
###########################################################
fw('\t\tUV-mapping :\n\t\t\t')
if faceuv:
# 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)
fw('%.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
fw('\n')
###########################################################
## NORMAL
###########################################################
if f.use_smooth:
localIsSmooth = 'vertex'
else:
localIsSmooth = 'face'
fw('\t\tNormal(%s) : %d\n\t\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
fw('%.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
fw('%.6f %.6f %.6f|' % noKey)
fw('\n')
if not faceuv:
f_image = None
###########################################################
## faces
###########################################################
fw('\t\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 :
fw("\n\t\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 :
fw("\n\t\t\t%s\n\t\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:
fw(" %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:
fw(" %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:
fw(" %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:
fw(" %d//%d" % (v.index + totverts-1, no-1))
fw('|')
fw('\n')
# Write edges. ==> did not know what it is ...
#fw('Faces : %d' % len(edges))
#for ed in edges:
# if ed.is_loose:
# fw('%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 ob_main.dupli_type != 'NONE':
ob_main.dupli_list_clear()
#####################################################################
## Save collision shapes (for one object :
#####################################################################
for subObj in getChildren(ob_main):
print(" child : '%s'" % (subObj.name))
if subObj.name.lower().startswith(EXPORT_COLLISION_NAME):
print(" find physics : '%s'" % (subObj.name))
writeCollisionShape(subObj, file, ob_main.scale)
#####################################################################
## 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_GLOBAL_MATRIX,
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, 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_GLOBAL_MATRIX,
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="",
global_matrix=None,
path_mode='AUTO'
):
_write(context,
filepath,
EXPORT_SEL_ONLY=use_selection,
EXPORT_GLOBAL_MATRIX=global_matrix,
EXPORT_PATH_MODE=path_mode,
EXPORT_BINARY_MODE=use_binary,
EXPORT_COLLISION_NAME=collision_object_name,
)
return {'FINISHED'}

1
build

@ -1 +0,0 @@
Subproject commit dd03e468326f087e3becf1f497ca7aa87d3c521b

View File

@ -7,12 +7,12 @@ precision mediump int;
attribute vec3 EW_coord3d;
attribute vec4 EW_color;
uniform mat4 EW_MatrixTransformation;
uniform mat4 EW_MatrixPosition;
// output :
varying vec4 f_color;
void main(void) {
gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
//gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0);
gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
f_color = EW_color;
}

View File

@ -50,9 +50,6 @@ void main(void) {
specularLight = pow(ecNormalDotLightHalfplane, EW_material.shininess) * EW_directionalLight.specularColor * EW_material.specularFactor;
specularLight = EW_directionalLight.specularColor * EW_material.specularFactor;
}
vec4 light = ambientLight + diffuseLight + specularLight;
gl_FragColor = tmpElementColor * light;
}

View File

@ -86,6 +86,7 @@ limitations under the License.
===== Program Using EWOL =====
:** [b][lib[edn | edn]][/b] : (Application in GPLv3) Edn is the main application using this lib and designed for (in the first time). This is a "Code editor".
:** [b][[http://play.google.com/store/apps/details?id=com.edouarddupin.worddown | worddown]][/b] : (Proprietary) Worddown is a simple word game.
== Main documentation: ==

2
external/agg vendored

@ -1 +1 @@
Subproject commit f2a9ffcdb201285f6d449f573a8c58e130d09b0b
Subproject commit af62bc418a88687a8a14f768d7936c5b104d085f

1
external/airtaudio vendored

@ -1 +0,0 @@
Subproject commit e15bfbe18e883fe3170a49a03732ad5dfe389fa8

1
external/audio vendored Submodule

@ -0,0 +1 @@
Subproject commit d8867378cea891fd1dfb5939cd319c7d98b075da

1
external/audio-algo-aec vendored Submodule

@ -0,0 +1 @@
Subproject commit cb12079db1986f2c677048942e4f4355d7cbb2ab

1
external/audio-algo-drain vendored Submodule

@ -0,0 +1 @@
Subproject commit e3e048f68a766e9236ea27fb0ee362e0ab6c2770

1
external/audio-blockEngine vendored Submodule

@ -0,0 +1 @@
Subproject commit 2f3a2c597676e6aec12319aa0c7f86f4b39242b2

1
external/audio-drain vendored Submodule

@ -0,0 +1 @@
Subproject commit 154d03e8bd80bb2e70b6abb4e2675aed9f300bdf

1
external/audio-ess vendored Submodule

@ -0,0 +1 @@
Subproject commit b3194c0bd9e1ae7306a5a0f764415be191444fb0

1
external/audio-orchestra vendored Submodule

@ -0,0 +1 @@
Subproject commit 32c0784d3b6b0bd55b7e2d3a5bb85ea77d53247d

1
external/audio-river vendored Submodule

@ -0,0 +1 @@
Subproject commit 4ba07ac08748695dab4f5b6c9cdb6b19f2769e18

1
external/eaudiofx vendored

@ -1 +0,0 @@
Subproject commit 428e8dfe393b5609e21b78267356e30a026cb0ad

View File

@ -15,6 +15,8 @@ def create(target):
'edtaa3/edtaa3func.c'
])
myModule.compile_version_CC(1999)
myModule.add_export_path(tools.get_current_path(__file__))
# add the currrent module at the

2
external/egami vendored

@ -1 +1 @@
Subproject commit e07648a33c85a8886c0e9dfb806ed8585c4d7553
Subproject commit 28a67a895c6ed998be2463d1a1bfcfbde4fce559

2
external/ege vendored

@ -1 +1 @@
Subproject commit 9930ce56c42052db422eef3de0d5494d3ccd3f10
Subproject commit a6fba88a18190cb28ee747ffe30a8af7f615e503

2
external/ejson vendored

@ -1 +1 @@
Subproject commit ad2d06e4361d9b37074433e5da1481237049c105
Subproject commit 82670a7954dc6c8e9f38f0feb74495ef9817f1b2

2
external/enet vendored

@ -1 +1 @@
Subproject commit 5a108ecdac60de39af102d9c158a87ab1c9ee6b2
Subproject commit b1ad254e0e8bf83dcae13cc0187151178eaf9f4e

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 738ee25fb8016e9fd7a3d62ac28a85eb99b4f197
Subproject commit 6c65d74094684130d4ffb438b6be96a6919257b0

2
external/etk vendored

@ -1 +1 @@
Subproject commit 63c9ff74c23a52aa8fd718a0c6d26fc6c88fab01
Subproject commit e9583aa3117523378aa660a88434f994a70409ca

1
external/ewolsa vendored

@ -1 +0,0 @@
Subproject commit 8d9aef8384ced7fc4a9b2761bf1966b4bdf5e231

2
external/exml vendored

@ -1 +1 @@
Subproject commit a4c544e916ed9d9519adedeb53d2f023e53aa360
Subproject commit a249eb5699dbd79c22f6e71ac38a671592f539af

1
external/gtest vendored Submodule

@ -0,0 +1 @@
Subproject commit ce08156cf70c62c8783e8cf7f1ddc90f5ceba94d

1
external/lua vendored

@ -1 +0,0 @@
Subproject commit a0505920fe022de956ef46c8a0be8263710105eb

2
external/ogg vendored

@ -1 +1 @@
Subproject commit fd44b865a3f42dbcae7c08888f2228c0644e980f
Subproject commit 4bbdfe1c53ec2368883b29f99b3635c36a87be48

1
external/speex vendored Submodule

@ -0,0 +1 @@
Subproject commit b0cc582eabc4eb2c8924fac517fe6a73e2d90193

1
external/speexdsp vendored Submodule

@ -0,0 +1 @@
Subproject commit 06d4e5f1afaaed841ec37728217a87b92fec8bae

View File

@ -18,6 +18,8 @@ def create(target):
myModule.add_module_depend('z')
myModule.compile_version_CC(1999)
myModule.compile_flags_CC([
"-DNOCRYPT",
"-DIOAPI_NO_64"])

View File

@ -29,6 +29,7 @@ def create(target):
myModule.add_export_path(tools.get_current_path(__file__))
myModule.add_export_path(tools.get_current_path(__file__) + "/zlib")
myModule.compile_flags_CC([
"-D_LARGEFILE64_SOURCE=1",
"-DHAVE_HIDDEN"])

1
monk

@ -1 +0,0 @@
Subproject commit 71ded394c57b4ed8954643eacde359c1a9bab52c

View File

@ -0,0 +1,57 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <etk/types.h>
#include <ewol/ewol.h>
#include <ewol/context/commandLine.h>
#include <appl/debug.h>
#include <appl/Windows.h>
#include <ewol/object/Object.h>
#include <ewol/widget/Manager.h>
#include <ewol/context/Context.h>
class MainApplication : public ewol::context::Application {
public:
bool init(ewol::Context& _context, size_t _initId) {
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
// TODO : Remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)");
return true;
}
void unInit(ewol::Context& _context) {
APPL_INFO("==> Un-Init APPL (START)");
// nothing to do ...
APPL_INFO("==> Un-Init APPL (END)");
}
};
/**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
* @param std IO
* @return std IO
*/
int main(int _argc, const char *_argv[]) {
// second possibility
return ewol::run(new MainApplication(), _argc, _argv);
}

View File

@ -0,0 +1,14 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_MAIN_H__
#define __APPL_MAIN_H__
#endif

View File

@ -0,0 +1,32 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <ewol/ewol.h>
#include <appl/debug.h>
#include <appl/Windows.h>
#include <ewol/widget/Label.h>
#undef __class__
#define __class__ "Windows"
appl::Windows::Windows() {
addObjectType("appl::Windows");
}
void appl::Windows::init() {
setTitle("example 001_HelloWord");
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
} else {
tmpWidget->setLabel("Hello <font color=\"blue\">Word</font>");
tmpWidget->setExpand(bvec2(true,true));
setSubWidget(tmpWidget);
}
}

View File

@ -0,0 +1,25 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_WINDOWS_H__
#define __APPL_WINDOWS_H__
#include <ewol/widget/Windows.h>
namespace appl {
class Windows : public ewol::widget::Windows {
protected:
Windows();
void init();
public:
DECLARE_FACTORY(Windows);
};
};
#endif

View File

@ -0,0 +1,15 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("example");
return g_val;
}

View File

@ -0,0 +1,43 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_DEBUG_H__
#define __APPL_DEBUG_H__
#include <etk/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)
#ifdef DEBUG
#define APPL_INFO(data) APPL_BASE(4, data)
#define APPL_DEBUG(data) APPL_BASE(5, data)
#define APPL_VERBOSE(data) APPL_BASE(6, data)
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
#else
#define APPL_INFO(data) do { } while(false)
#define APPL_DEBUG(data) do { } while(false)
#define APPL_VERBOSE(data) do { } while(false)
#define APPL_TODO(data) do { } while(false)
#endif
#define APPL_ASSERT(cond,data) \
do { \
if (!(cond)) { \
APPL_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)
#endif

View File

@ -0,0 +1,32 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
# optionnal : Describe in the "lutin.py --help"
def get_desc():
return "Tutorial 001 : Hello Word"
# Module creation instance (not optionnal)
def create(target):
# module name is '001_HelloWord' and type binary.
myModule = module.Module(__file__, '001_HelloWord', 'BINARY')
# add the file to compile:
myModule.add_src_file([
'appl/Main.cpp',
'appl/debug.cpp',
'appl/Windows.cpp',
])
# add Library dependency name
myModule.add_module_depend(['ewol'])
# add application C flags
myModule.compile_flags_CC([
"-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""])
# Add current include Path
myModule.add_path(tools.get_current_path(__file__))
# return the created module
return myModule

View File

@ -0,0 +1,57 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#include <etk/types.h>
#include <ewol/ewol.h>
#include <ewol/context/commandLine.h>
#include <appl/debug.h>
#include <appl/Windows.h>
#include <ewol/object/Object.h>
#include <ewol/widget/Manager.h>
#include <ewol/context/Context.h>
#include <appl/widget/VectorDisplay.h>
class MainApplication : public ewol::context::Application {
public:
bool init(ewol::Context& _context, size_t _initId) {
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
// TODO : Remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
appl::widget::VectorDisplay::createManagerWidget(_context.getWidgetManager());
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)");
return true;
}
void unInit(ewol::Context& _context) {
APPL_INFO("==> Un-Init APPL (START)");
// nothing to do...
APPL_INFO("==> Un-Init APPL (END)");
}
};
/**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
* @param std IO
* @return std IO
*/
int main(int _argc, const char *_argv[]) {
// second possibility
return ewol::run(new MainApplication(), _argc, _argv);
}

View File

@ -0,0 +1,14 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#ifndef __APPL_MAIN_H__
#define __APPL_MAIN_H__
#endif

View File

@ -0,0 +1,74 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#include <ewol/ewol.h>
#include <appl/debug.h>
#include <appl/Windows.h>
#include <ewol/widget/Label.h>
#include <ewol/widget/Button.h>
#include <appl/widget/VectorDisplay.h>
#include <etk/tool.h>
#undef __class__
#define __class__ "Windows"
static const char* const g_eventChangeValues = "appl-change-value";
static const char* const g_eventAutoMode = "appl-change-auto";
appl::Windows::Windows() :
m_composer(NULL) {
addObjectType("appl::Windows");
}
void appl::Windows::init() {
setTitle("example 001_HelloWord");
std::string composition = std::string("");
composition += "<sizer mode='vert'>\n";
composition += " <sizer mode='hori'>\n";
composition += " <button name='bt-change'>\n";
composition += " <label>\n";
composition += " Change Data ...\n";
composition += " </label>\n";
composition += " </button>\n";
composition += " <button name='bt-auto'>\n";
composition += " <label>\n";
composition += " Auto generate\n";
composition += " </label>\n";
composition += " </button>\n";
composition += " </sizer>\n";
composition += " <VectorDisplay name='displayer' expand='true' fill='true'/>\n";
composition += "</sizer>\n";
m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition);
if (m_composer == NULL) {
APPL_CRITICAL(" An error occured ... in the windows creatrion ...");
return;
}
setSubWidget(m_composer);
subBind(ewol::widget::Button, "bt-change", signalPressed, shared_from_this(), &appl::Windows::onCallbackChangeValues);
subBind(ewol::widget::Button, "bt-auto", signalPressed, shared_from_this(), &appl::Windows::onCallbackAutoMode);
}
void appl::Windows::onCallbackChangeValues() {
std::vector<float> tmp;
for (int32_t iii=0; iii<2048; ++iii) {
tmp.push_back(etk::tool::frand(-1.0, 1.0));
}
std::shared_ptr<appl::widget::VectorDisplay> tmpDisp = std::dynamic_pointer_cast<appl::widget::VectorDisplay>(getSubObjectNamed("displayer"));
if (tmpDisp != NULL) {
tmpDisp->setValue(tmp);
}
}
void appl::Windows::onCallbackAutoMode() {
std::shared_ptr<appl::widget::VectorDisplay> tmpDisp = std::dynamic_pointer_cast<appl::widget::VectorDisplay>(getSubObjectNamed("displayer"));
if (tmpDisp != NULL) {
tmpDisp->ToggleAuto();
}
}

View File

@ -0,0 +1,31 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#ifndef __APPL_WINDOWS_H__
#define __APPL_WINDOWS_H__
#include <ewol/widget/Windows.h>
#include <ewol/widget/Composer.h>
namespace appl {
class Windows : public ewol::widget::Windows {
private:
std::shared_ptr<ewol::widget::Composer> m_composer;
protected:
Windows();
void init();
public:
DECLARE_FACTORY(Windows);
public: // callback functions
void onCallbackChangeValues();
void onCallbackAutoMode();
};
};
#endif

View File

@ -0,0 +1,15 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("example");
return g_val;
}

View File

@ -0,0 +1,43 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#ifndef __APPL_DEBUG_H__
#define __APPL_DEBUG_H__
#include <etk/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)
#ifdef DEBUG
#define APPL_INFO(data) APPL_BASE(4, data)
#define APPL_DEBUG(data) APPL_BASE(5, data)
#define APPL_VERBOSE(data) APPL_BASE(6, data)
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
#else
#define APPL_INFO(data) do { } while(false)
#define APPL_DEBUG(data) do { } while(false)
#define APPL_VERBOSE(data) do { } while(false)
#define APPL_TODO(data) do { } while(false)
#endif
#define APPL_ASSERT(cond,data) \
do { \
if (!(cond)) { \
APPL_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)
#endif

View File

@ -0,0 +1,92 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#include <appl/debug.h>
#include <appl/widget/VectorDisplay.h>
#include <etk/tool.h>
#undef __class__
#define __class__ "VectorDisplay"
appl::widget::VectorDisplay::VectorDisplay() :
m_autoDisplay(false),
m_minVal(-1.0f),
m_maxVal(1.0f) {
addObjectType("appl::widget::VectorDisplay");
}
void appl::widget::VectorDisplay::init() {
ewol::Widget::init();
markToRedraw();
}
appl::widget::VectorDisplay::~VectorDisplay() {
}
void appl::widget::VectorDisplay::setValue(const std::vector<float>& _data) {
m_data = _data;
markToRedraw();
}
void appl::widget::VectorDisplay::ToggleAuto() {
if (m_autoDisplay == false) {
periodicCallEnable();
m_autoDisplay = true;
} else {
periodicCallDisable();
m_autoDisplay = false;
}
}
void appl::widget::VectorDisplay::onDraw() {
m_draw.draw();
}
void appl::widget::VectorDisplay::onRegenerateDisplay() {
//!< Check if we really need to redraw the display, if not needed, we redraw the previous data ...
if (needRedraw() == false) {
return;
}
// remove previous data
m_draw.clear();
// set background
m_draw.setColor(etk::color::black);
m_draw.setPos(vec2(0,0));
m_draw.rectangleWidth(m_size);
if (m_data.size() == 0) {
return;
}
// set all the line:
m_draw.setColor(etk::color::white);
m_draw.setThickness(1);
float origin = m_size.y()*0.5f;
float ratioY = m_size.y() / (m_maxVal - m_minVal);
float stepX = m_size.x() / (float)m_data.size();
m_draw.setPos(vec2(0, origin + ratioY*m_data[0]));
float baseX = 0;
for (size_t iii=1; iii<m_data.size(); ++iii) {
m_draw.lineTo(vec2((float)iii*stepX, origin + ratioY*m_data[iii]));
}
}
void appl::widget::VectorDisplay::periodicCall(const ewol::event::Time& _event) {
for (size_t iii=0; iii<std::max(m_data.size()/200.0f, 50.0f); ++iii) {
if (m_data.size() > 50) {
m_data.erase(m_data.begin());
}
m_data.push_back(etk::tool::frand(m_minVal, m_maxVal));
}
markToRedraw();
}

View File

@ -0,0 +1,48 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license BSD 3 clauses (see license file)
*/
#ifndef __APPL_WIDGET_VECTOR_DISPLAY_H__
#define __APPL_WIDGET_VECTOR_DISPLAY_H__
#include <ewol/widget/Widget.h>
#include <ewol/compositing/Drawing.h>
#include <ewol/widget/Manager.h>
namespace appl {
namespace widget {
class VectorDisplay : public ewol::Widget {
private:
ewol::compositing::Drawing m_draw; //!< drawing instance
protected:
//! @brief constructor
VectorDisplay();
void init();
public:
DECLARE_WIDGET_FACTORY(VectorDisplay, "VectorDisplay");
//! @brief destructor
virtual ~VectorDisplay();
private:
std::vector<float> m_data; //!< data that might be displayed
public:
void setValue(const std::vector<float>& _data);
private:
bool m_autoDisplay;
public:
void ToggleAuto();
private:
float m_minVal; //!< display minimum value
float m_maxVal; //!< display maximum value
public: // herited function
virtual void onDraw();
virtual void onRegenerateDisplay();
virtual void periodicCall(const ewol::event::Time& _event);
};
};
};
#endif

View File

@ -0,0 +1,34 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
# optionnal : Describe in the "lutin.py --help"
def get_desc():
return "Tutorial 0XX : Create custom Widget"
# Module creation instance (not optionnal)
def create(target):
# module name is '001_HelloWord' and type binary.
myModule = module.Module(__file__, '0XX_customwidget', 'BINARY')
# add the file to compile:
myModule.add_src_file([
'appl/Main.cpp',
'appl/debug.cpp',
'appl/Windows.cpp',
'appl/widget/VectorDisplay.cpp',
])
# add Library dependency name
myModule.add_module_depend(['ewol'])
# add application C flags
myModule.compile_flags_CC([
"-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""])
# Add current include Path
myModule.add_path(tools.get_current_path(__file__))
# return the created module
return myModule

52
sample/README.md Normal file
View File

@ -0,0 +1,52 @@
Ewol Samples
============
Ewol sample are a FREE software for learn use of ewol.
Instructions
============
download the software :
git clone git://github.com/HeeroYui/ewol.git
cd ewol
git submodule init
git submodule update
Compile software and install : (build all binary and libs)
ewol/build/lutin.py -j4
Dependency packages
===================
sudo apt-get install g++ libgl1-mesa-dev zlib1g-dev libasound2-dev
# if you want to compile with clang :
sudo apt-get install clang
# For andoid compilation (jdk 7 does not work...)
sudo apt-get install javacc openjdk-6-jdk
# if you want to compile for windows :
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-mingw-w64
# on 64 bits processor for compatibility
sudo apt-get install ia32-libs
sudo apt-get install g++-multilib libc6-dev-i386
License (APACHE v2.0)
=====================
Copyright ewol Edouard DUPIN
Licensed under the Apache 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
http://www.apache.org/licenses/LICENSE-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.

BIN
sample/data/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,57 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <etk/types.h>
#include <ewol/ewol.h>
#include <ewol/context/commandLine.h>
#include <appl/debug.h>
#include <appl/Windows.h>
#include <ewol/object/Object.h>
#include <ewol/widget/Manager.h>
#include <ewol/context/Context.h>
class MainApplication : public ewol::context::Application {
public:
bool init(ewol::Context& _context, size_t _initId) {
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
// TODO : Remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)");
return true;
}
void unInit(ewol::Context& _context) {
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
// nothing to do ...
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
}
};
/**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
* @param std IO
* @return std IO
*/
int main(int _argc, const char *_argv[]) {
// second possibility
return ewol::run(new MainApplication(), _argc, _argv);
}

View File

@ -0,0 +1,14 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_MAIN_H__
#define __APPL_MAIN_H__
#endif

View File

@ -0,0 +1,116 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/WidgetDisplay.h>
#include <appl/debug.h>
#include <etk/tool.h>
#undef __class__
#define __class__ "WidgetDisplay"
appl::WidgetDisplay::WidgetDisplay() {
addObjectType("appl::WidgetDisplay");
}
void appl::WidgetDisplay::init() {
ewol::Widget::init();
m_compositing.setSource("DATA:SnowFlake.svg", ivec2(128,128));
setCanHaveFocus(true);
periodicCallEnable();
for (int32_t iii=0; iii<250 ; ++iii) {
m_elements.push_back(appl::WidgetDisplay::Element());
}
}
appl::WidgetDisplay::~WidgetDisplay() {
}
void appl::WidgetDisplay::onDraw() {
m_compositing.draw();
}
appl::WidgetDisplay::Element::Element() {
regenerate(vec2(1024,2048));
m_lifeTime = etk::tool::frand(-4,4);
m_life = m_lifeTime;
}
void appl::WidgetDisplay::Element::regenerate(const vec2& _size) {
float sizeDisplay=etk::tool::frand(10,64);
m_position = vec2(etk::tool::frand(0,_size.x()),
etk::tool::frand(_size.y(),_size.y()+64));
m_size = vec2(sizeDisplay,sizeDisplay);
m_angle = etk::tool::frand(-3.1415952f,3.1415952f);
m_lifeTime = etk::tool::frand(1,10);
m_life = m_lifeTime;
m_lifeTime += 4;
m_angleAdd = etk::tool::frand(-0.05f,0.05f);
m_downSpeed = etk::tool::frand(0.5f,3.f);
}
void appl::WidgetDisplay::Element::move(float _deltaTime) {
m_lifeTime -= _deltaTime;
m_position -= vec2(0, m_downSpeed);
m_angle += m_angleAdd;
}
void appl::WidgetDisplay::onRegenerateDisplay() {
if (needRedraw() == false) {
return;
}
// remove data of the previous composition :
m_compositing.clear();
for (int32_t iii=0; iii<m_elements.size() ; ++iii) {
if (m_elements[iii].m_lifeTime < 0.0f) {
int32_t color = 0xFF*(1.0f+0.25*m_elements[iii].m_lifeTime);
m_compositing.setColor(etk::Color<>(0xFF, 0xFF, 0xFF, color));
} else if (m_elements[iii].m_lifeTime > m_elements[iii].m_life) {
int32_t color = 0xFF*(1.0f-0.25*(m_elements[iii].m_lifeTime - m_elements[iii].m_life));
m_compositing.setColor(etk::Color<>(0xFF, 0xFF, 0xFF, color));
} else {
m_compositing.setColor(etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF));
}
//3d7dab
m_compositing.setPos(m_elements[iii].m_position);
m_compositing.setAngle(m_elements[iii].m_angle);
m_compositing.print(m_elements[iii].m_size);
}
}
void appl::WidgetDisplay::periodicCall(const ewol::event::Time& _event) {
float curentDelta=_event.getDeltaCall();
// set the somposition properties :
for (int32_t iii=0; iii<m_elements.size() ; ++iii) {
m_elements[iii].move(curentDelta);
if( m_elements[iii].m_lifeTime < -4.0f
|| m_elements[iii].m_position.y() < -m_elements[iii].m_size.y()*1.4f) {
// change properties
m_elements[iii].regenerate(m_size);
}
}
markToRedraw();
}
bool appl::WidgetDisplay::onEventInput(const ewol::event::Input& _event) {
//EWOL_DEBUG("Input event : " << _event);
vec2 relPos = relativePosition(_event.getPos());
if (_event.getType() == ewol::key::typeFinger) {
keepFocus();
if (1 == _event.getId()) {
APPL_DEBUG("Touch event ... ");
}
}
return false;
}

View File

@ -0,0 +1,49 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_WIDGET_DISPLAY_H__
#define __APPL_WIDGET_DISPLAY_H__
#include <draw/Color.h>
#include <ewol/widget/Widget.h>
#include <ewol/compositing/Image.h>
namespace appl {
class WidgetDisplay : public ewol::Widget {
private:
class Element {
public:
Element();
vec2 m_position;
vec2 m_size;
float m_angle;
float m_lifeTime;
float m_life;
float m_angleAdd;
float m_downSpeed;
void regenerate(const vec2& _size);
void move(float _deltaTime);
};
protected:
WidgetDisplay();
void init();
public:
DECLARE_FACTORY(WidgetDisplay);
virtual ~WidgetDisplay();
ewol::compositing::Image m_compositing;
std::vector<Element> m_elements;
public: // Derived function
void onRegenerateDisplay();
virtual void periodicCall(const ewol::event::Time& _event);
virtual bool onEventInput(const ewol::event::Input& _event);
virtual void onDraw();
};
};
#endif

View File

@ -0,0 +1,39 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <ewol/ewol.h>
#include <appl/debug.h>
#include <appl/WidgetDisplay.h>
#include <appl/Windows.h>
#undef __class__
#define __class__ "Windows"
appl::Windows::Windows() {
addObjectType("appl::Windows");
}
void appl::Windows::init() {
ewol::widget::Windows::init();
setTitle("example Wallpaper");
std::shared_ptr<appl::WidgetDisplay> tmpWidget = appl::WidgetDisplay::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
} else {
setSubWidget(tmpWidget);
tmpWidget->setExpand(bvec2(true,true));
tmpWidget->setFill(bvec2(true,true));
}
setBackgroundColor(etk::Color<float>(0,0,0,0));
}
appl::Windows::~Windows() {
}

View File

@ -0,0 +1,27 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_WINDOWS_H__
#define __APPL_WINDOWS_H__
#include <appl/WidgetDisplay.h>
#include <ewol/widget/Windows.h>
namespace appl {
class Windows : public ewol::widget::Windows {
protected:
Windows();
void init();
public:
DECLARE_FACTORY(Windows);
virtual ~Windows();
};
};
#endif

View File

@ -0,0 +1,15 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("example");
return g_val;
}

View File

@ -0,0 +1,43 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __APPL_DEBUG_H__
#define __APPL_DEBUG_H__
#include <etk/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)
#ifdef DEBUG
#define APPL_INFO(data) APPL_BASE(4, data)
#define APPL_DEBUG(data) APPL_BASE(5, data)
#define APPL_VERBOSE(data) APPL_BASE(6, data)
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
#else
#define APPL_INFO(data) do { } while(false)
#define APPL_DEBUG(data) do { } while(false)
#define APPL_VERBOSE(data) do { } while(false)
#define APPL_TODO(data) do { } while(false)
#endif
#define APPL_ASSERT(cond,data) \
do { \
if (!(cond)) { \
APPL_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)
#endif

View File

@ -0,0 +1,5 @@
<?xml encoding="UTF-8"?>
<svg width="397" height="411">
<path d="M 183.3125,43.09375 L 183.3125,83.8125 L 152.71875,66.125 L 137.1875,92.9375 L 183.3125,119.65625 L 183.3125,179.75 L 131.5,149.8125 L 131.40625,96.28125 L 100.40625,96.34375 L 100.46875,131.90625 L 65.09375,111.46875 L 49.59375,138.3125 L 84.875,158.6875 L 54.25,176.3125 L 69.6875,203.1875 L 115.90625,176.59375 L 167.90625,206.625 L 116.09375,236.53125 L 69.6875,209.84375 L 54.25,236.71875 L 85.0625,254.46875 L 49.6875,274.875 L 65.1875,301.71875 L 100.46875,281.34375 L 100.40625,316.6875 L 131.40625,316.75 L 131.5,263.4375 L 183.5,233.4375 L 183.5,293.25 L 137.1875,320.09375 L 152.71875,346.90625 L 183.5,329.09375 L 183.5,369.9375 L 214.5,369.9375 L 214.5,329.21875 L 245.09375,346.90625 L 260.625,320.09375 L 214.5,293.375 L 214.5,233.28125 L 266.3125,263.21875 L 266.40625,316.75 L 297.40625,316.6875 L 297.34375,281.125 L 332.71875,301.5625 L 348.21875,274.71875 L 312.9375,254.34375 L 343.5625,236.71875 L 328.125,209.84375 L 281.9375,236.4375 L 229.90625,206.40625 L 281.75,176.46875 L 328.125,203.1875 L 343.5625,176.3125 L 312.75,158.5625 L 348.125,138.15625 L 332.625,111.3125 L 297.34375,131.6875 L 297.40625,96.34375 L 266.40625,96.28125 L 266.3125,149.59375 L 214.3125,179.59375 L 214.3125,119.78125 L 260.625,92.9375 L 245.09375,66.125 L 214.3125,83.9375 L 214.3125,43.09375 L 183.3125,43.09375 z"
style="fill:#fff;fill-opacity:1;stroke:none"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,61 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
import datetime
def get_desc():
return "Tutorial xxx example wallpaper"
def create(target):
# module name is 'edn' and type binary.
myModule = module.Module(__file__, 'examplewallpaper', 'PACKAGE')
# add the file to compile:
myModule.add_src_file([
'appl/Main.cpp',
'appl/debug.cpp',
'appl/WidgetDisplay.cpp',
'appl/Windows.cpp',
])
myModule.add_module_depend(['ewol'])
myModule.compile_flags_CC([
"-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""])
myModule.copy_folder('data/SnowFlake.svg','')
myModule.add_path(tools.get_current_path(__file__))
now = datetime.datetime.now()
versionID=str(now.year-2013)+"."+str(now.month)+"."+str(now.day)
# set the package properties :
myModule.pkg_set("VERSION", versionID)
myModule.pkg_set("COMPAGNY_TYPE", "org")
myModule.pkg_set("COMPAGNY_NAME", "EWOL")
myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
myModule.pkg_set("ICON", tools.get_current_path(__file__) + "/../data/icon.png")
myModule.pkg_set("SECTION", "example")
myModule.pkg_set("PRIORITY", "extra")
myModule.pkg_set("DESCRIPTION", "EWOL example for Wallpaper on Android")
myModule.pkg_set("NAME", "ewol Wallpaper ewample")
myModule.pkg_set("ANDROID_APPL_TYPE", "WALLPAPER")
#for the exemple :
myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", \
[ ["key","value display"],\
["key2","value display 2"]\
] \
])
myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]])
# add the currrent module at the
return myModule

13
sample/license.txt Normal file
View File

@ -0,0 +1,13 @@
Copyright ewol samples Edouard DUPIN
Licensed under the Apache 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
http://www.apache.org/licenses/LICENSE-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.

View File

@ -344,7 +344,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
public String audioGetDeviceProperty(int idDevice) {
if (idDevice == 0) {
return "speaker:out:8000,16000,24000,32000,48000,96000:2:s16";
return "speaker:out:8000,16000,24000,32000,48000,96000:2:int16";
} else {
return "::::";
}

View File

@ -61,7 +61,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) {
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// TextureID
m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
// position :

View File

@ -227,6 +227,7 @@ ewol::compositing::Drawing::Drawing() :
m_GLprogram(nullptr),
m_GLPosition(-1),
m_GLMatrix(-1),
m_GLMatrixPosition(-1),
m_GLColor(-1),
m_thickness(0.0),
m_triElement(0) {
@ -290,6 +291,7 @@ void ewol::compositing::Drawing::loadProgram() {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
m_GLMatrixPosition = m_GLprogram->getUniform("EW_MatrixPosition");
}
}
@ -306,7 +308,9 @@ void ewol::compositing::Drawing::draw(bool _disableDepthTest) {
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
mat4 tmpMatrix2;
m_GLprogram->uniformMatrix(m_GLMatrixPosition, tmpMatrix2);
// position :
m_GLprogram->sendAttribute(m_GLPosition, m_coord);
// color :

View File

@ -31,6 +31,7 @@ namespace ewol {
std::shared_ptr<ewol::resource::Program> m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLMatrixPosition; //!< position matrix
int32_t m_GLColor; //!< openGL id on the element (color buffer)
private: // Background Color (display only when needed)
std::vector<vec3 > m_coord; //!< internal position for the text display

View File

@ -78,7 +78,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// TextureID
if (m_resource != nullptr) {
if (m_distanceFieldMode == true) {

View File

@ -184,7 +184,7 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) {
m_GLprogram->use();
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::getMatrix();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// position :
m_GLprogram->sendAttribute(m_GLPosition, 2/*x,y*/, m_coord);
// property

View File

@ -51,7 +51,7 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en
mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// Texture :
m_GLprogram->setTexture0(m_GLtexID, m_font->getId());
m_GLprogram->uniform1i(m_GLtextWidth, m_font->getOpenGlSize().x());
@ -90,7 +90,7 @@ void ewol::compositing::Text::drawD(bool _disableDepthTest) {
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// Texture :
m_GLprogram->setTexture0(m_GLtexID, m_font->getId());
m_GLprogram->uniform1i(m_GLtextWidth, m_font->getOpenGlSize().x());

View File

@ -245,7 +245,7 @@ void ewol::compositing::TextBase::print(const std::string& _text) {
}
void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
void ewol::compositing::TextBase::parseHtmlNode(const std::shared_ptr<const exml::Element>& _element) {
// get the static real pointer
if (_element == nullptr) {
EWOL_ERROR( "Error Input node does not existed ...");
@ -254,15 +254,15 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) {
if (_element->getType(iii) == exml::typeComment) {
// nothing to do ...
} else if (_element->getType(iii) == exml::typeText) {
exml::Node* child = _element->getNode(iii);
std::shared_ptr<const exml::Node> child = _element->getNode(iii);
htmlAddData(etk::to_u32string(child->getValue()));
EWOL_VERBOSE("XML add : " << child->getValue());
continue;
} else if (_element->getType(iii)!=exml::typeElement) {
} else if (_element->getType(iii) != exml::typeElement) {
EWOL_ERROR("(l "<< _element->getNode(iii)->getPos() << ") node not suported type : " << _element->getType(iii) << " val=\""<< _element->getNode(iii)->getValue() << "\"" );
continue;
}
exml::Element* elem = _element->getElement(iii);
std::shared_ptr<const exml::Element> elem = _element->getElement(iii);
if (elem == nullptr) {
EWOL_ERROR("Cast error ...");
continue;
@ -373,13 +373,13 @@ void ewol::compositing::TextBase::printHTML(const std::string& _text) {
return;
}
exml::Element* root = (exml::Element*)doc.getNamed( "html" );
std::shared_ptr<const exml::Element> root = doc.getNamed( "html" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"html\"");
doc.display();
return;
}
exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" );
std::shared_ptr<const exml::Element> bodyNode = root->getNamed( "body" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"body\"");
return;
@ -401,13 +401,13 @@ void ewol::compositing::TextBase::printHTML(const std::u32string& _text) {
return;
}
exml::Element* root = (exml::Element*)doc.getNamed( "html" );
std::shared_ptr<exml::Element> root = doc.getNamed( "html" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"html\"");
doc.display();
return;
}
exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" );
std::shared_ptr<exml::Element> bodyNode = root->getNamed( "body" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"body\"");
return;

View File

@ -357,7 +357,7 @@ namespace ewol {
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
* @param[in] _element the exml element.
*/
void parseHtmlNode(exml::Element* _element);
void parseHtmlNode(const std::shared_ptr<const exml::Element>& _element);
public:
/**
* @brief This generate the possibility to generate the big text property

View File

@ -62,7 +62,7 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _
mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// Texture :
m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getId());
m_GLprogram->uniform1i(m_GLtextWidth, m_fontDF->getOpenGlSize().x());
@ -100,7 +100,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) {
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix);
// Texture :
m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getId());
m_GLprogram->uniform1i(m_GLtextWidth, m_fontDF->getOpenGlSize().x());

View File

@ -647,7 +647,7 @@ extern "C" {
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved) {
// get the java virtual machine handle ...
std::unique_lock<std::mutex> lock(g_interfaceMutex);
std::unique_lock<std::mutex> lock(g_interfaceAudioMutex);
std::unique_lock<std::mutex> lockAudio(g_interfaceAudioMutex);
g_JavaVM = _jvm;
EWOL_DEBUG("JNI-> load the jvm ..." );
return JNI_VERSION_1_6;
@ -655,7 +655,7 @@ extern "C" {
// JNI onUnLoad
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved) {
std::unique_lock<std::mutex> lock(g_interfaceMutex);
std::unique_lock<std::mutex> lock(g_interfaceAudioMutex);
std::unique_lock<std::mutex> lockAudio(g_interfaceAudioMutex);
g_JavaVM = nullptr;
EWOL_DEBUG("JNI-> Un-load the jvm ..." );
}

View File

@ -12,6 +12,7 @@
#include <etk/tool.h>
#include <etk/os/FSNode.h>
#include <etk/thread/tools.h>
#include <mutex>
#include <date/date.h>
@ -305,6 +306,8 @@ ewol::Context::Context(ewol::context::Application* _application, int32_t _argc,
m_windowsCurrent(nullptr),
m_windowsSize(320,480),
m_initStepId(0) {
// set a basic
etk::thread::setName("ewol");
if (m_application == nullptr) {
EWOL_CRITICAL("Can not start context with no Application ==> rtfm ...");
}
@ -592,7 +595,7 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
}
}
// call all the widget that neded to do something periodicly
m_widgetManager.periodicCall(currentTime);
m_objectManager.timeCall(currentTime);
// check if the user selected a windows
if (nullptr != m_windowsCurrent) {
// Redraw all needed elements
@ -641,7 +644,7 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
m_FpsFlush.tic();
m_FpsFlush.incrementCounter();
}
glFlush();
ewol::openGL::flush();
//glFinish();
if (m_displayFps == true) {
m_FpsFlush.toc();
@ -731,7 +734,7 @@ void ewol::Context::OS_Resume() {
lockContext();
EWOL_INFO("OS_Resume...");
m_previousDisplayTime = ewol::getTime();
m_widgetManager.periodicCallResume(m_previousDisplayTime);
m_objectManager.timeCallResume(m_previousDisplayTime);
if (m_windowsCurrent != nullptr) {
m_windowsCurrent->onStateResume();
}

View File

@ -29,6 +29,7 @@
#include <sys/times.h>
#include <mach/clock.h>
#include <mach/mach.h>
#include <etk/etk.h>
int64_t ewol::getTime() {
@ -232,6 +233,7 @@ void IOs::foreground() {
static int l_argc = 0;
static const char **l_argv = nullptr;
static ewol::context::Application* l_application;
/**
* @brief Main of the program
* @param std IO
@ -240,14 +242,16 @@ static const char **l_argv = nullptr;
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
l_argc = _argc;
l_argv = _argv;
return mm_main(_application, _argc, _argv);
l_application = _application;
return mm_main(_argc, _argv);
}
// Creat and relaese ewol::Context interface:
void IOs::createInterface() {
etk::setArgZero(l_argv[0]);
etk::init(l_argc, l_argv);
EWOL_INFO("Create new interface");
interface = new MacOSInterface(l_argc, l_argv);
interface = new MacOSInterface(l_application, l_argc, l_argv);
l_application = nullptr;
if (nullptr == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return;
@ -255,10 +259,9 @@ void IOs::createInterface() {
}
void IOs::releaseInterface() {
if (interface == nullptr) {
return;
}
if (interface != nullptr) {
EWOL_INFO("Remove interface");
}
delete(interface);
interface = nullptr;
}

View File

@ -15,7 +15,8 @@
int mm_main(int argc, const char *argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, (char**)argv, nil, NSStringFromClass([AppDelegate class]));
} // return no error
}
// return no error
return 0;
}
@ -24,6 +25,7 @@ void mm_exit(void) {
}
void mm_openURL(const char *_url) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:_url]];
NSString* url = [[NSString alloc] initWithUTF8String:_url];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}

View File

@ -34,8 +34,8 @@
int deltaDisplay;
int displayCounter;
}
- ()stopDisplayLink;
- ()startDisplayLink;
- ()speedSlow;
- ()speedNormal;
- (void)stopDisplayLink;
- (void)startDisplayLink;
- (void)speedSlow;
- (void)speedNormal;
@end

View File

@ -29,6 +29,7 @@
#include <sys/times.h>
#include <mach/clock.h>
#include <mach/mach.h>
#include <etk/etk.h>
int64_t ewol::getTime() {
@ -173,7 +174,7 @@ void MacOs::setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::k
* @return std IO
*/
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
etk::setArgZero(_argv[0]);
etk::init(_argc, _argv);
interface = new MacOSInterface(_application, _argc, _argv);
if (nullptr == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");

View File

@ -14,7 +14,7 @@ extern "C" {
#endif
int mm_main(int argc, const char *argv[]);
int mm_run();
int mm_run(void);
#ifdef __cplusplus
}

View File

@ -84,7 +84,7 @@ int mm_main(int argc, const char *argv[]) {
//[window addChildWindow:view];
//[window makeKeyAndVisible];
[window setDelegate:view];
//[window setDelegate:view];
#else
@autoreleasepool
{

View File

@ -13,7 +13,7 @@
}
+ (id)alloc;
- (id)init;
+ ()dealloc;
+ (void)dealloc;
@end

View File

@ -60,7 +60,7 @@
//[window addChildWindow:view];
//[window makeKeyAndVisible];
[windowsID setDelegate:view];
//[windowsID setDelegate:view];
EWOL_DEBUG("ALLOCATE ...");
return windowsID;
}

View File

@ -24,6 +24,7 @@
#include <sys/time.h>
#include <windows.h>
#include <windowsx.h>
#include <etk/etk.h>
@ -478,7 +479,7 @@ class WindowsContext : public ewol::Context {
* @return std IO
*/
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
etk::setArgZero(_argv[0]);
etk::init(_argc, _argv);
GLenum err = glewInit();
if (GLEW_OK != err) {
// Problem: glewInit failed, something is seriously wrong.

View File

@ -24,6 +24,7 @@
#include <ewol/resource/Manager.h>
#include <ewol/context/Context.h>
#include <ewol/Dimension.h>
#include <etk/etk.h>
#if defined(__TARGET_OS__Linux)
@ -1323,7 +1324,7 @@ class X11Interface : public ewol::Context {
* @return std IO
*/
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
etk::setArgZero(_argv[0]);
etk::init(_argc, _argv);
X11Interface* interface = new X11Interface(_application, _argc, _argv);
if (interface == nullptr) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");

View File

@ -14,16 +14,7 @@
namespace ewol {
int32_t getLogId();
};
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
#define EWOL_BASE(info,data) \
do { \
if (info <= etk::log::getLevel(ewol::getLogId())) { \
std::stringbuf sb; \
std::ostream tmpStream(&sb); \
tmpStream << data; \
etk::log::logStream(ewol::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
} \
} while(0)
#define EWOL_BASE(info,data) TK_LOG_BASE(ewol::getLogId(),info,data)
#define EWOL_CRITICAL(data) EWOL_BASE(1, data)
#define EWOL_ERROR(data) EWOL_BASE(2, data)

View File

@ -19,3 +19,16 @@ std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Tim
_os << "}";
return _os;
}
namespace etk {
template<> std::string to_string<ewol::event::Time>(ewol::event::Time const& _obj) {
std::string out;
out = "{[ewol::event::Time]time=" + etk::to_string(_obj.getTime());
out += ";uptime=" + etk::to_string(_obj.getApplUpTime());
out += ";delta=" + etk::to_string(_obj.getDelta());
out += ";deltaCall=" + etk::to_string(_obj.getDeltaCall());
out += "}";
return out;
}
}

View File

@ -16,8 +16,14 @@
#define __class__ "ewol::object::Manager"
ewol::object::Manager::Manager(ewol::Context& _context) :
m_context(_context) {
m_context(_context),
periodicCall(*this, "periodic", "Call every time system render"),
m_applWakeUpTime(0),
m_lastPeriodicCallTime(0) {
EWOL_DEBUG(" == > init Object-Manager");
// set the basic time properties :
m_applWakeUpTime = ewol::getTime();
m_lastPeriodicCallTime = ewol::getTime();
}
ewol::object::Manager::~Manager() {
@ -123,3 +129,22 @@ void ewol::object::Manager::workerRemove(const std::shared_ptr<ewol::Object>& _w
}
}
}
void ewol::object::Manager::timeCall(int64_t _localTime) {
int64_t previousTime = m_lastPeriodicCallTime;
m_lastPeriodicCallTime = _localTime;
if (periodicCall.getNumberConnected() <= 0) {
return;
}
float deltaTime = (float)(_localTime - previousTime)/1000000.0;
ewol::event::Time myTime(_localTime, m_applWakeUpTime, deltaTime, deltaTime);
periodicCall.emit(myTime);
}
void ewol::object::Manager::timeCallResume(int64_t _localTime) {
m_lastPeriodicCallTime = _localTime;
}
bool ewol::object::Manager::timeCallHave() {
return periodicCall.getNumberConnected() > 0;
}

View File

@ -11,11 +11,13 @@
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <ewol/signal/Signal.h>
#include <ewol/event/Time.h>
namespace ewol {
class Context;
namespace object {
class Manager {
class Manager : public ewol::signal::Interface {
private:
std::vector<std::weak_ptr<ewol::Object>> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
Context& m_context;
@ -75,6 +77,28 @@ namespace ewol {
* @param[in] _worker Worker to add in the list.
*/
void workerRemove(const std::shared_ptr<ewol::Object>& _worker);
public:
ewol::Signal<ewol::event::Time> periodicCall;
private:
int64_t m_applWakeUpTime; //!< Time of the application initialize
int64_t m_lastPeriodicCallTime; //!< last call time ...
public: // ewol system internal :
/**
* @brief Call every time we can with the current time
* @param[in] _localTime Current system Time.
*/
void timeCall(int64_t _localTime);
/**
* @brief If the application is suspended The Ewol Object manager does not know it, just call this to update delta call
* @param[in] _localTime Current system Time.
*/
void timeCallResume(int64_t _localTime);
/**
* @breif check if the Interface have some user that request a periodic call
* @return true, have some periodic event...
*/
bool timeCallHave();
};
};
};

View File

@ -108,8 +108,8 @@ bool ewol::Object::isTypeCompatible(const std::string& _type) {
return false;
}
bool ewol::Object::loadXML(exml::Element* _node) {
if (nullptr == _node) {
bool ewol::Object::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
return false;
}
bool errorOccured = false;
@ -126,7 +126,7 @@ bool ewol::Object::loadXML(exml::Element* _node) {
return errorOccured;
}
bool ewol::Object::storeXML(exml::Element* _node) const {
bool ewol::Object::storeXML(const std::shared_ptr<exml::Element>& _node) const {
if (nullptr == _node) {
return false;
}
@ -164,3 +164,11 @@ std::shared_ptr<ewol::Object> ewol::Object::getSubObjectNamed(const std::string&
return nullptr;
}
bool ewol::parameterSetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
std::shared_ptr<ewol::Object> object = ewol::getContext().getEObjectManager().get(_objectName);
if (object == nullptr) {
return false;
}
return object->parameterSet(_config, _value);
}

View File

@ -15,6 +15,13 @@
#include <mutex>
#include <memory>
#include <ewol/debug.h>
#include <ewol/parameter/Interface.h>
#include <ewol/parameter/Value.h>
#include <ewol/parameter/Range.h>
#include <ewol/parameter/List.h>
#include <ewol/signal/Interface.h>
namespace ewol {
// some class need to define element befor other ...
class Object;
@ -24,13 +31,6 @@ namespace ewol {
class Context;
};
#include <ewol/debug.h>
#include <ewol/object/ParameterList.h>
#include <ewol/object/Param.h>
#include <ewol/object/ParamRange.h>
#include <ewol/object/ParamList.h>
#include <ewol/object/SignalList.h>
#define DECLARE_FACTORY(className) \
template<typename ... T> static std::shared_ptr<className> create( T&& ... all ) { \
std::shared_ptr<className> object(new className()); \
@ -51,8 +51,8 @@ namespace ewol {
* this class mermit at every Object to communicate between them.
*/
class Object : public std::enable_shared_from_this<Object>,
public ewol::object::ParameterList,
public ewol::object::SignalList {
public ewol::parameter::Interface,
public ewol::signal::Interface {
private:
static size_t m_valUID; //!< Static used for the unique ID definition
private:
@ -145,7 +145,7 @@ namespace ewol {
// TODO : Rework the position on this function ... This is a convignent function ...
bool parameterSetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value);
protected:
ewol::object::Param<std::string> m_name; //!< name of the element ...
ewol::parameter::Value<std::string> m_name; //!< name of the element ...
public:
/**
* @brief get the Object name
@ -168,14 +168,14 @@ namespace ewol {
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool loadXML(exml::Element* _node);
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
/**
* @brief store properties in this XML node.
* @param[in,out] _node Pointer on the tinyXML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool storeXML(exml::Element* _node) const;
virtual bool storeXML(const std::shared_ptr<exml::Element>& _node) const;
public:
/**
* @breif get the current Object manager.
@ -222,16 +222,16 @@ namespace ewol {
/**
* @brief link on an signal in the subwiget with his name
*/
#define subBind(_type, _name, _event, _obj, _func) do {\
#define subBind(_type, _name, _event, _shared_ptr, _func, ...) do {\
std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \
if (myObject != nullptr) { \
myObject->_event.bind(_obj, _func); \
myObject->_event.bind(_shared_ptr, _func, ##__VA_ARGS__); \
} else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
} while (false)
/*
template<class TYPE> void bind(std::shared_ptr<ewol::Object> _obj, void (TYPE::*_func)()) {
template<class TYPE> void subBind(std::shared_ptr<ewol::Object> _obj, void (TYPE::*_func)()) {
std::shared_ptr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj);
if (obj2 == nullptr) {
EWOL_ERROR("Can not bind signal ...");
@ -241,16 +241,16 @@ namespace ewol {
}
*/
};
bool parameterSetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value);
};
/**
* @brief link on an signal in the global object list with his name
*/
#define globalBind(_type, _name, _event, _obj, _func) do {\
#define globalBind(_type, _name, _event, _obj, _func, ...) do {\
std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(ewol::getContext().getEObjectManager().getObjectNamed(_name)); \
if (myObject != nullptr) { \
myObject->_event.bind(_obj, _func); \
myObject->_event.bind(_obj, _func, ##__VA_ARGS__); \
} else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
@ -259,15 +259,15 @@ namespace ewol {
/**
* @brief link on an signal in the subWidget of an object with his name
*/
#define externSubBind(_object, _type, _name, _event, _obj, _func) do {\
#define externSubBind(_object, _type, _name, _event, _obj, _func, ...) do {\
std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(_object->getObjectNamed(_name)); \
if (myObject != nullptr) { \
myObject->_event.bind(_obj, _func); \
myObject->_event.bind(_obj, _func, ##__VA_ARGS__); \
} else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
} while (false)
//#include <ewol/object/Signal.h>
//#include <ewol/signal/Signal.h>
#endif

View File

@ -1,10 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/object/ParamList.h>

View File

@ -1,30 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/object/ParameterList.h>
#include <ewol/object/Parameter.h>
ewol::object::Parameter::Parameter(ewol::object::ParameterList& _objectLink, const std::string& _name) :
m_objectLink(_objectLink),
m_name(_name) {
// add a reference on the current parameter ...
_objectLink.parameterAdd(this);
}
void ewol::object::Parameter::notifyChange() const {
m_objectLink.onParameterChangeValue(ewol::object::ParameterRef(this));
}
bool ewol::object::operator==(const ParameterRef& _obj, const Parameter& _obj2) noexcept {
return &_obj2 == _obj.m_ref;
}
bool ewol::object::operator==(const Parameter& _obj2, const ParameterRef& _obj) noexcept {
return &_obj2 == _obj.m_ref;
}

View File

@ -1,211 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <ewol/object/Object.h>
#ifndef __EWOL_SIGNAL_H__
#define __EWOL_SIGNAL_H__
#include <functional>
#include <ewol/object/ParameterList.h>
#include <ewol/object/SignalBase.h>
#include <ewol/object/Object.h>
namespace ewol {
namespace object {
#undef __class__
#define __class__ "object::Signal<T>"
template<typename T> class Signal : public SignalBase {
private:
std::vector<std::pair<std::weak_ptr<ewol::Object>,
std::function<void(const T&)>>> m_callerList;
public:
/**
* @brief Create a parameter with a specific type.
* @param[in] _objectLink reference on the parameter lister.
* @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter.
* @param[in] _min Minumum value.
* @param[in] _max Maximum value.
* @param[in] _description description of the parameter.
*/
Signal(ewol::object::SignalList& _objectLink,
const std::string& _name,
const std::string& _description = "") :
SignalBase(_objectLink, _name, _description) {
};
/**
* @brief Destructor.
*/
virtual ~Signal() { };
/**
* @brief Bind a callback function to the current signal (generic methis (simplest))
* @param[in] _obj Shared pointer on the caller object
* @param[in] _func Link on the fuction that might be called (inside a class)
* @example signalXXXX.bind(shared_from_this(), &ClassName::onCallbackXXX);
*/
template<class TYPE> void bind(std::shared_ptr<ewol::Object> _obj, void (TYPE::*_func)(const T&)) {
std::shared_ptr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj);
if (obj2 == nullptr) {
EWOL_ERROR("Can not bind signal ...");
return;
}
m_callerList.push_back(std::make_pair(std::weak_ptr<ewol::Object>(_obj), std::bind(_func, obj2.get(), std::placeholders::_1)));
}
/**
* @brief Advanced binding a callback function to the current signal.
* @param[in] _obj Shared pointer on the caller object
* @param[in] _func functor to call (do it yourself)
* @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1));
*/
void connect(std::shared_ptr<ewol::Object> _obj, std::function<void(const T&)> _function ) {
m_callerList.push_back(std::make_pair(std::weak_ptr<ewol::Object>(_obj), _function));
}
/**
* @brief remove link on the signal.
* @param[in] _obj shared pointer on the removing object
*/
void release(std::shared_ptr<ewol::Object> _obj) {
auto it(m_callerList.begin());
while(it != m_callerList.end()) {
if (it->first.lock() == _obj) {
it = m_callerList.erase(it);
} else {
++it;
}
}
}
/**
* @brief Generate a signal on all interface listening.
* @param[in] _data data to emit
*/
void emit(const T& _data) {
#ifdef DEBUG
int32_t tmpID = m_uidSignal++;
ewol::Object* srcObject = dynamic_cast<ewol::Object*>(&m_objectLink);
if (srcObject != nullptr) {
EWOL_VERBOSE("emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' data='" << etk::to_string(_data) << "' to:");
} else {
EWOL_VERBOSE("emit signal{" << tmpID << "} : signal='" << m_name << "' data='" << etk::to_string(_data) << "' to:");
}
#endif
for (auto &it : m_callerList) {
std::shared_ptr<ewol::Object> destObject = it.first.lock();
if (destObject == nullptr) {
// TODO : Remove instance ...
EWOL_VERBOSE(" nullptr dest");
continue;
}
#ifdef DEBUG
if (srcObject != nullptr) {
EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType());
} else {
EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType());
}
#endif
it.second(_data);
}
}
};
#undef __class__
#define __class__ "object::Signal<void>"
template<> class Signal<void> : public SignalBase {
private:
std::vector<std::pair<std::weak_ptr<ewol::Object>, std::function<void()>>> m_callerList;
public:
/**
* @brief Create a parameter with a specific type.
* @param[in] _objectLink reference on the parameter lister.
* @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter.
* @param[in] _min Minumum value.
* @param[in] _max Maximum value.
* @param[in] _description description of the parameter.
*/
Signal(ewol::object::SignalList& _objectLink,
const std::string& _name,
const std::string& _description = "") :
SignalBase(_objectLink, _name, _description) {
};
/**
* @brief Destructor.
*/
virtual ~Signal() { };
/**
* @brief Bind a callback function to the current signal (generic methis (simplest))
* @param[in] _obj Shared pointer on the caller object
* @param[in] _func Link on the fuction that might be called (inside a class)
* @example signalXXXX.connect(shared_from_this(), &ClassName::onCallbackXXX);
*/
template<class TYPE> void bind(std::shared_ptr<ewol::Object> _obj, void (TYPE::*_func)()) {
std::shared_ptr<TYPE> obj2 = std::dynamic_pointer_cast<TYPE>(_obj);
if (obj2 == nullptr) {
EWOL_ERROR("Can not bind signal ...");
return;
}
m_callerList.push_back(std::make_pair(std::weak_ptr<ewol::Object>(_obj), std::bind(_func, obj2.get())));
}
/**
* @brief Advanced binding a callback function to the current signal.
* @param[in] _obj Shared pointer on the caller object
* @param[in] _func functor to call (do it yourself)
* @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1));
*/
void connect(std::shared_ptr<ewol::Object> _obj, std::function<void()> _function ) {
m_callerList.push_back(std::make_pair(std::weak_ptr<ewol::Object>(_obj), _function));
}
/**
* @brief remove link on the signal.
* @param[in] _obj shared pointer on the removing object
*/
void release(std::shared_ptr<ewol::Object> _obj) {
auto it(m_callerList.begin());
while(it != m_callerList.end()) {
if (it->first.lock() == _obj) {
it = m_callerList.erase(it);
} else {
++it;
}
}
}
void emit() {
#ifdef DEBUG
int32_t tmpID = m_uidSignal++;
ewol::Object* srcObject = dynamic_cast<ewol::Object*>(&m_objectLink);
if (srcObject != nullptr) {
EWOL_VERBOSE("emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' BANG!!! to:");
} else {
EWOL_VERBOSE("emit signal{" << tmpID << "} : signal='" << m_name << "' to:");
}
#endif
for (auto &it : m_callerList) {
std::shared_ptr<ewol::Object> destObject = it.first.lock();
if (destObject == nullptr) {
// TODO : Remove instance ...
EWOL_VERBOSE(" nullptr dest");
continue;
}
#ifdef DEBUG
if (srcObject != nullptr) {
EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType());
} else {
EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType());
}
#endif
it.second();
}
}
};
#undef __class__
#define __class__ nullptr
};
};
#endif

View File

@ -1,30 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <memory>
#include <ewol/debug.h>
#include <ewol/object/Object.h>
#include <ewol/object/SignalList.h>
#include <ewol/object/SignalBase.h>
int32_t ewol::object::SignalBase::m_uidSignal = 0;
ewol::object::SignalBase::SignalBase(ewol::object::SignalList& _objectLink,
const std::string& _name,
const std::string& _description) :
m_objectLink(_objectLink),
m_name(_name),
m_description(_description) {
// add a reference on the current signal ...
m_objectLink.signalAdd(this);
}
std::ostream& ewol::object::operator <<(std::ostream& _os, const ewol::object::SignalBase& _obj) {
_os << _obj.getName();
return _os;
}

View File

@ -9,7 +9,32 @@
#include <vector>
#include <ewol/debug.h>
#include <ewol/openGL/openGL.h>
#include <etk/stdTools.h>
#include <mutex>
//#define DIRECT_MODE
#define CHECK_ERROR_OPENGL
static void checkGlError(const char* _op, int32_t _localLine) {
#ifdef CHECK_ERROR_OPENGL
bool hasError = false;
for (GLint error = glGetError(); error; error = glGetError()) {
EWOL_ERROR("after " << _op << "():" << _localLine << " glError(" << error << ")");
hasError = true;
}
if (hasError == true) {
EWOL_CRITICAL("plop");
}
#endif
}
#define OPENGL_ERROR(data) do { } while (false)
//#define OPENGL_ERROR(data) EWOL_ERROR(data)
#define OPENGL_WARNING(data) do { } while (false)
//#define OPENGL_WARNING(data) EWOL_WARNING(data)
#define OPENGL_INFO(data) do { } while (false)
//#define OPENGL_INFO(data) EWOL_INFO(data)
/**
* @brief get the draw mutex (ewol render).
@ -111,13 +136,116 @@ void ewol::openGL::finish() {
void ewol::openGL::flush() {
l_programId = -1;
l_textureflags = 0;
glFlush();
OPENGL_INFO("========================" );
OPENGL_INFO("== FLUSH OPEN GL ==" );
OPENGL_INFO("========================");
}
void ewol::openGL::swap() {
}
//#define DIRECT_MODE
std::ostream& ewol::operator <<(std::ostream& _os, const enum openGL::openGlFlags& _obj) {
static std::vector<std::pair<enum openGL::openGlFlags, const char*>> list = {
std::make_pair(openGL::FLAG_BLEND, "FLAG_BLEND"),
std::make_pair(openGL::FLAG_CLIP_DISTANCE_I, "FLAG_CLIP_DISTANCE_I"),
std::make_pair(openGL::FLAG_COLOR_LOGIC_OP, "FLAG_COLOR_LOGIC_OP"),
std::make_pair(openGL::FLAG_CULL_FACE, "FLAG_CULL_FACE"),
std::make_pair(openGL::FLAG_DEBUG_OUTPUT, "FLAG_DEBUG_OUTPUT"),
std::make_pair(openGL::FLAG_DEBUG_OUTPUT_SYNCHRONOUS, "FLAG_DEBUG_OUTPUT_SYNCHRONOUS"),
std::make_pair(openGL::FLAG_DEPTH_CLAMP, "FLAG_DEPTH_CLAMP"),
std::make_pair(openGL::FLAG_DEPTH_TEST, "FLAG_DEPTH_TEST"),
std::make_pair(openGL::FLAG_DITHER, "FLAG_DITHER"),
std::make_pair(openGL::FLAG_FRAMEBUFFER_SRGB, "FLAG_FRAMEBUFFER_SRGB"),
std::make_pair(openGL::FLAG_LINE_SMOOTH, "FLAG_LINE_SMOOTH"),
std::make_pair(openGL::FLAG_MULTISAMPLE, "FLAG_MULTISAMPLE"),
std::make_pair(openGL::FLAG_POLYGON_OFFSET_FILL, "FLAG_POLYGON_OFFSET_FILL"),
std::make_pair(openGL::FLAG_POLYGON_OFFSET_LINE, "FLAG_POLYGON_OFFSET_LINE"),
std::make_pair(openGL::FLAG_POLYGON_OFFSET_POINT, "FLAG_POLYGON_OFFSET_POINT"),
std::make_pair(openGL::FLAG_POLYGON_SMOOTH, "FLAG_POLYGON_SMOOTH"),
std::make_pair(openGL::FLAG_PRIMITIVE_RESTART, "FLAG_PRIMITIVE_RESTART"),
std::make_pair(openGL::FLAG_PRIMITIVE_RESTART_FIXED_INDEX, "FLAG_PRIMITIVE_RESTART_FIXED_INDEX"),
std::make_pair(openGL::FLAG_SAMPLE_ALPHA_TO_COVERAGE, "FLAG_SAMPLE_ALPHA_TO_COVERAGE"),
std::make_pair(openGL::FLAG_SAMPLE_ALPHA_TO_ONE, "FLAG_SAMPLE_ALPHA_TO_ONE"),
std::make_pair(openGL::FLAG_SAMPLE_COVERAGE, "FLAG_SAMPLE_COVERAGE"),
std::make_pair(openGL::FLAG_SAMPLE_SHADING, "FLAG_SAMPLE_SHADING"),
std::make_pair(openGL::FLAG_SAMPLE_MASK, "FLAG_SAMPLE_MASK"),
std::make_pair(openGL::FLAG_SCISSOR_TEST, "FLAG_SCISSOR_TEST"),
std::make_pair(openGL::FLAG_STENCIL_TEST, "FLAG_STENCIL_TEST"),
std::make_pair(openGL::FLAG_PROGRAM_POINT_SIZE, "FLAG_PROGRAM_POINT_SIZE"),
std::make_pair(openGL::FLAG_TEXTURE_2D, "FLAG_TEXTURE_2D"),
std::make_pair(openGL::FLAG_ALPHA_TEST, "FLAG_ALPHA_TEST"),
std::make_pair(openGL::FLAG_FOG, "FLAG_FOG")
};
_os << "{";
bool hasOne = false;
for (auto &it : list) {
if ((_obj & it.first) != 0) {
if (hasOne==true) {
_os << ",";
}
_os << it.second;
hasOne = true;
}
}
_os << "}";
return _os;
}
std::vector<std::pair<enum ewol::openGL::renderMode, std::string>>& getListRenderMode() {
static std::vector<std::pair<enum ewol::openGL::renderMode, std::string>> list = {
std::make_pair(ewol::openGL::renderPoint, "POINTS"),
std::make_pair(ewol::openGL::renderLine, "LINES"),
std::make_pair(ewol::openGL::renderLineStrip, "LINES_STRIP"),
std::make_pair(ewol::openGL::renderLineLoop, "LINE_LOOP"),
std::make_pair(ewol::openGL::renderTriangle, "TRIANGLE"),
std::make_pair(ewol::openGL::renderTriangleStrip, "TRIANGLE_STRIP"),
std::make_pair(ewol::openGL::renderTriangleFan, "TRIANGLE_FAN"),
std::make_pair(ewol::openGL::renderQuad, "QUAD"),
std::make_pair(ewol::openGL::renderQuadStrip, "QUAD_STRIP"),
std::make_pair(ewol::openGL::renderPolygon, "POLYGON"),
};
return list;
}
namespace etk {
template<> std::string to_string<ewol::openGL::renderMode>(const ewol::openGL::renderMode& _obj) {
for (auto &it : getListRenderMode()) {
if (it.first == _obj) {
return it.second;
}
}
EWOL_ERROR("Can not convert : " << static_cast<int32_t>(_obj) << " return UNKNOW");
return "UNKNOW";
}
template<> std::u32string to_u32string<ewol::openGL::renderMode>(const ewol::openGL::renderMode& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<ewol::openGL::renderMode>(ewol::openGL::renderMode& _variableRet, const std::string& _value) {
for (auto &it : getListRenderMode()) {
if (it.second == _value) {
_variableRet = it.first;
return true;
}
}
EWOL_WARNING("Can not parse : '" << _value << "' set Triangle default value");
_variableRet = ewol::openGL::renderTriangle;
return false;
}
template<> bool from_string<ewol::openGL::renderMode>(ewol::openGL::renderMode& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
};
std::ostream& ewol::operator <<(std::ostream& _os, const enum openGL::renderMode& _obj) {
_os << etk::to_string(_obj);
return _os;
}
typedef struct {
uint32_t curentFlag;
@ -182,8 +310,19 @@ static correspondenceTable_ts basicFlag[] = {
};
static int32_t basicFlagCount = sizeof(basicFlag) / sizeof(correspondenceTable_ts);
void ewol::openGL::reset() {
#ifdef DIRECT_MODE
EWOL_TODO("...");
#else
l_flagsMustBeSet = 0;
l_programId = -1;
l_textureflags = 0;
updateAllFlags();
#endif
}
void ewol::openGL::enable(enum ewol::openGL::openGlFlags _flagID) {
//EWOL_INFO("Enable : " <EWOL_ERROR< _flagID);
#ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if ( basicFlag[iii].curentFlag == (uint32_t)_flagID ) {
@ -198,6 +337,7 @@ void ewol::openGL::enable(enum ewol::openGL::openGlFlags _flagID) {
}
void ewol::openGL::disable(enum ewol::openGL::openGlFlags _flagID) {
//EWOL_INFO("Disable : " << _flagID);
#ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if ( basicFlag[iii].curentFlag == (uint32_t)_flagID ) {
@ -217,16 +357,19 @@ void ewol::openGL::updateAllFlags() {
#endif
// check if fhags has change :
if (l_flagsMustBeSet == l_flagsCurrent ) {
OPENGL_INFO("OGL: current flag : " << (enum openGL::openGlFlags)l_flagsMustBeSet);
return;
}
//EWOL_DEBUG(" == >" << l_flagsMustBeSet);
OPENGL_INFO("OGL: set new flag : " << (enum openGL::openGlFlags)l_flagsMustBeSet);
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
uint32_t CurrentFlag = basicFlag[iii].curentFlag;
if ( (l_flagsMustBeSet&CurrentFlag)!=(l_flagsCurrent&CurrentFlag) ) {
if ( (l_flagsMustBeSet&CurrentFlag) != 0) {
glEnable(basicFlag[iii].OGlFlag);
OPENGL_INFO(" enable : " << (enum openGL::openGlFlags)basicFlag[iii].curentFlag);
} else {
glDisable(basicFlag[iii].OGlFlag);
OPENGL_INFO(" disable : " << (enum openGL::openGlFlags)basicFlag[iii].curentFlag);
}
}
}
@ -300,3 +443,54 @@ void ewol::openGL::useProgram(int32_t _id) {
}
bool ewol::openGL::genBuffers(std::vector<GLuint>& _buffers) {
if (_buffers.size() == 0) {
EWOL_WARNING("try to generate vector buffer with size 0");
return true;
}
OPENGL_INFO("Create N=" << _buffers.size() << " Buffer");
glGenBuffers(_buffers.size(), &_buffers[0]);
checkGlError("glGenBuffers", __LINE__);
bool hasError = false;
for (size_t iii=0; iii<_buffers.size(); iii++) {
if (_buffers[iii] == 0) {
EWOL_ERROR("[" << iii << "] error to create a buffer id=" << _buffers[iii]);
hasError = true;
}
}
return hasError;
}
bool ewol::openGL::deleteBuffers(std::vector<GLuint>& _buffers) {
if (_buffers.size() == 0) {
EWOL_WARNING("try to delete vector buffer with size 0");
return true;
}
glDeleteBuffers(_buffers.size(), &_buffers[0]);
checkGlError("glDeleteBuffers", __LINE__);
for (auto &it : _buffers) {
it = 0;
}
return true;
}
bool ewol::openGL::bindBuffer(GLuint _bufferId) {
glBindBuffer(GL_ARRAY_BUFFER, _bufferId);
checkGlError("glBindBuffer", __LINE__);
return true;
}
bool ewol::openGL::bufferData(size_t _size, const void* _data, GLenum _usage) {
glBufferData(GL_ARRAY_BUFFER, _size, _data, _usage);
checkGlError("glBufferData", __LINE__);
return true;
}
bool ewol::openGL::unbindBuffer() {
glBindBuffer(GL_ARRAY_BUFFER, 0);
checkGlError("glBindBuffer(0)", __LINE__);
return true;
}

View File

@ -141,6 +141,24 @@ namespace ewol {
FLAG_ALPHA_TEST = 1<<27, //!<
FLAG_FOG = 1<<28, //!<
};
enum renderMode {
renderPoint = GL_POINTS,
renderLine = GL_LINES,
renderLineStrip = GL_LINE_STRIP, //!< Not supported in EWOL (TODO : Later)
renderLineLoop = GL_LINE_LOOP,
renderTriangle = GL_TRIANGLES,
renderTriangleStrip = GL_TRIANGLE_STRIP, //!< Not supported in EWOL (TODO : Later)
renderTriangleFan = GL_TRIANGLE_FAN, //!< Not supported in EWOL (TODO : Later)
#if (!defined(__TARGET_OS__IOs) && !defined(__TARGET_OS__Android))
renderQuad = GL_QUADS, //!< Not supported in OpenGL-ES2
renderQuadStrip = GL_QUAD_STRIP, //!< Not supported in OpenGL-ES2
renderPolygon = GL_POLYGON //!< Not supported in OpenGL-ES2
#else
renderQuad, //!< Not supported in OpenGL-ES2
renderQuadStrip, //!< Not supported in OpenGL-ES2
renderPolygon //!< Not supported in OpenGL-ES2
#endif
};
/**
* @brief enable a flag on the system
@ -178,7 +196,17 @@ namespace ewol {
* @param[in] id Id of the program that might be used
*/
void useProgram(int32_t _id);
void reset();
bool genBuffers(std::vector<GLuint>& _buffers);
bool deleteBuffers(std::vector<GLuint>& _buffers);
bool bindBuffer(GLuint _bufferId);
bool bufferData(size_t _size, const void* _data, GLenum _usage);
bool unbindBuffer();
};
std::ostream& operator <<(std::ostream& _os, const enum openGL::openGlFlags& _obj);
std::ostream& operator <<(std::ostream& _os, const enum openGL::renderMode& _obj);
};

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