-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import + merge + split projects from davidB : jme3_ext_remote_editor,…
… xbuf_jaime
- Loading branch information
David Bernard
committed
Mar 31, 2015
1 parent
c397645
commit 4da67fb
Showing
51 changed files
with
3,917 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/lib | ||
lib | ||
tmp | ||
*.off | ||
*.orig | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
Creative Commons Legal Code | ||
|
||
CC0 1.0 Universal | ||
|
||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE | ||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN | ||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS | ||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES | ||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS | ||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM | ||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED | ||
HEREUNDER. | ||
|
||
Statement of Purpose | ||
|
||
The laws of most jurisdictions throughout the world automatically confer | ||
exclusive Copyright and Related Rights (defined below) upon the creator | ||
and subsequent owner(s) (each and all, an "owner") of an original work of | ||
authorship and/or a database (each, a "Work"). | ||
|
||
Certain owners wish to permanently relinquish those rights to a Work for | ||
the purpose of contributing to a commons of creative, cultural and | ||
scientific works ("Commons") that the public can reliably and without fear | ||
of later claims of infringement build upon, modify, incorporate in other | ||
works, reuse and redistribute as freely as possible in any form whatsoever | ||
and for any purposes, including without limitation commercial purposes. | ||
These owners may contribute to the Commons to promote the ideal of a free | ||
culture and the further production of creative, cultural and scientific | ||
works, or to gain reputation or greater distribution for their Work in | ||
part through the use and efforts of others. | ||
|
||
For these and/or other purposes and motivations, and without any | ||
expectation of additional consideration or compensation, the person | ||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she | ||
is an owner of Copyright and Related Rights in the Work, voluntarily | ||
elects to apply CC0 to the Work and publicly distribute the Work under its | ||
terms, with knowledge of his or her Copyright and Related Rights in the | ||
Work and the meaning and intended legal effect of CC0 on those rights. | ||
|
||
1. Copyright and Related Rights. A Work made available under CC0 may be | ||
protected by copyright and related or neighboring rights ("Copyright and | ||
Related Rights"). Copyright and Related Rights include, but are not | ||
limited to, the following: | ||
|
||
i. the right to reproduce, adapt, distribute, perform, display, | ||
communicate, and translate a Work; | ||
|
||
ii. moral rights retained by the original author(s) and/or performer(s); | ||
|
||
iii. publicity and privacy rights pertaining to a person's image or | ||
likeness depicted in a Work; | ||
|
||
iv. rights protecting against unfair competition in regards to a Work, | ||
subject to the limitations in paragraph 4(a), below; | ||
|
||
v. rights protecting the extraction, dissemination, use and reuse of data | ||
in a Work; | ||
|
||
vi. database rights (such as those arising under Directive 96/9/EC of the | ||
European Parliament and of the Council of 11 March 1996 on the legal | ||
protection of databases, and under any national implementation | ||
thereof, including any amended or successor version of such | ||
directive); and | ||
|
||
vii. other similar, equivalent or corresponding rights throughout the | ||
world based on applicable law or treaty, and any national | ||
implementations thereof. | ||
|
||
2. Waiver. To the greatest extent permitted by, but not in contravention | ||
of, applicable law, Affirmer hereby overtly, fully, permanently, | ||
irrevocably and unconditionally waives, abandons, and surrenders all of | ||
Affirmer's Copyright and Related Rights and associated claims and causes | ||
of action, whether now known or unknown (including existing as well as | ||
future claims and causes of action), in the Work (i) in all territories | ||
worldwide, (ii) for the maximum duration provided by applicable law or | ||
treaty (including future time extensions), (iii) in any current or future | ||
medium and for any number of copies, and (iv) for any purpose whatsoever, | ||
including without limitation commercial, advertising or promotional | ||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each | ||
member of the public at large and to the detriment of Affirmer's heirs and | ||
successors, fully intending that such Waiver shall not be subject to | ||
revocation, rescission, cancellation, termination, or any other legal or | ||
equitable action to disrupt the quiet enjoyment of the Work by the public | ||
as contemplated by Affirmer's express Statement of Purpose. | ||
|
||
3. Public License Fallback. Should any part of the Waiver for any reason | ||
be judged legally invalid or ineffective under applicable law, then the | ||
Waiver shall be preserved to the maximum extent permitted taking into | ||
account Affirmer's express Statement of Purpose. In addition, to the | ||
extent the Waiver is so judged Affirmer hereby grants to each affected | ||
person a royalty-free, non transferable, non sublicensable, non exclusive, | ||
irrevocable and unconditional license to exercise Affirmer's Copyright and | ||
Related Rights in the Work (i) in all territories worldwide, (ii) for the | ||
maximum duration provided by applicable law or treaty (including future | ||
time extensions), (iii) in any current or future medium and for any number | ||
of copies, and (iv) for any purpose whatsoever, including without | ||
limitation commercial, advertising or promotional purposes (the | ||
"License"). The License shall be deemed effective as of the date CC0 was | ||
applied by Affirmer to the Work. Should any part of the License for any | ||
reason be judged legally invalid or ineffective under applicable law, such | ||
partial invalidity or ineffectiveness shall not invalidate the remainder | ||
of the License, and in such case Affirmer hereby affirms that he or she | ||
will not (i) exercise any of his or her remaining Copyright and Related | ||
Rights in the Work or (ii) assert any associated claims and causes of | ||
action with respect to the Work, in either case contrary to Affirmer's | ||
express Statement of Purpose. | ||
|
||
4. Limitations and Disclaimers. | ||
|
||
a. No trademark or patent rights held by Affirmer are waived, abandoned, | ||
surrendered, licensed or otherwise affected by this document. | ||
|
||
b. Affirmer offers the Work as-is and makes no representations or | ||
warranties of any kind concerning the Work, express, implied, | ||
statutory or otherwise, including without limitation warranties of | ||
title, merchantability, fitness for a particular purpose, non | ||
infringement, or the absence of latent or other defects, accuracy, or | ||
the present or absence of errors, whether or not discoverable, all to | ||
the greatest extent permissible under applicable law. | ||
|
||
c. Affirmer disclaims responsibility for clearing rights of other persons | ||
that may apply to the Work or any use thereof, including without | ||
limitation any person's Copyright and Related Rights in the Work. | ||
Further, Affirmer disclaims responsibility for obtaining any necessary | ||
consents, permissions or other rights required for any use of the | ||
Work. | ||
|
||
d. Affirmer understands and acknowledges that Creative Commons is not a | ||
party to this document and has no duty or obligation with respect to | ||
this CC0 or use of the Work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.6' | ||
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:1.12.+' | ||
classpath "org.xtend:xtend-gradle-plugin:0.3.4" | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
// Global | ||
// content of this section could be placed in an other script | ||
//------------------------------------------------------------------------------ | ||
|
||
allprojects { | ||
group = "org.xbuf.jme3" | ||
version = "0.4.0" | ||
def description = 'xbuf lib and tools for jMonkeyEngine (jme3)' | ||
} | ||
|
||
subprojects { | ||
apply plugin: 'java' // assets are managed like java resource + code | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
repositories { | ||
mavenLocal() | ||
jcenter() | ||
maven { url "http://updates.jmonkeyengine.org/maven/"} | ||
maven { url "http://dl.bintray.com/davidb/jme3stuff" } | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from sourceSets.main.allSource | ||
classifier = 'sources' | ||
} | ||
|
||
def pomConfig = { | ||
licenses { | ||
license { | ||
name "Public domain (CC0-1.0)" | ||
url "http://creativecommons.org/publicdomain/zero/1.0/" | ||
distribution "repo" | ||
} | ||
} | ||
developers { | ||
developer { | ||
id "davidB" | ||
name "David Bernard" | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenStuff(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
pom.withXml { | ||
def root = asNode() | ||
if (description) root.appendNode('description', project.description) | ||
root.children().last() + pomConfig | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
bintray { | ||
user = bintray_user | ||
key = bintray_api_key | ||
|
||
publications = ['mavenStuff'] //When uploading Maven-based publication files | ||
//dryRun = true //Whether to run this as dry-run, without deploying | ||
publish = true //If version should be auto published after an upload | ||
pkg { | ||
repo = 'jme3stuff' | ||
name = project.name | ||
desc = project.description | ||
websiteUrl = "https://github.com/davidB/${rootProject.name}" | ||
issueTrackerUrl = "https://github.com/davidB/${rootProject.name}/issues" | ||
vcsUrl = "https://github.com/davidB/${rootProject.name}.git" | ||
licenses = ['CC0-1.0'] | ||
labels = ['jme3'] | ||
publicDownloadNumbers = true | ||
version { | ||
name = project.version | ||
vcsTag = project.version | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v_jme=3.0.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'provided-base' | ||
apply plugin: "org.xtend.xtend" | ||
|
||
//WARNING: this project is 1.7 compatible but ModelViewer require javafx and java 8u20+ to run | ||
sourceCompatibility = JavaVersion.VERSION_1_7 | ||
targetCompatibility = JavaVersion.VERSION_1_7 | ||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' | ||
|
||
def description = "An experimental remote display of a jMonkeyEngine application for remote edition (eg: via blender)" | ||
|
||
sourceSets.main.resources.srcDir 'src/main/java' | ||
|
||
def v_slf4j = '1.7.7' | ||
def v_jme3 = '3.0.10' | ||
|
||
dependencies { | ||
compile 'org.eclipse.xtend:org.eclipse.xtend.lib:2.7.+' | ||
compile "org.slf4j:slf4j-api:${v_slf4j}" | ||
compile 'org.xbuf:xbuf:0+' | ||
provided "com.jme3:jme3-core:${v_jme3}" | ||
testCompile 'junit:junit:4.12' | ||
testRuntime 'ch.qos.logback:logback-classic:1.1.2' | ||
} |
49 changes: 49 additions & 0 deletions
49
jme3_xbuf_loader/src/main/java/jme3_ext_animation/CompositeTrack.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package jme3_ext_animation; | ||
|
||
import com.jme3.animation.AnimChannel | ||
import com.jme3.animation.AnimControl | ||
import com.jme3.animation.Track | ||
import com.jme3.export.JmeExporter | ||
import com.jme3.export.JmeImporter | ||
import com.jme3.util.TempVars | ||
import java.util.ArrayList | ||
import java.util.List | ||
|
||
class CompositeTrack implements Track { | ||
public val tracks = new ArrayList<Track>() as List<Track> | ||
|
||
override setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) { | ||
for (Track t : tracks) { | ||
t.setTime(time, weight, control, channel, vars) | ||
} | ||
} | ||
|
||
override getLength() { | ||
var lg = 0f; | ||
for (Track t : tracks) { | ||
lg = Math.max(lg, t.getLength()) | ||
} | ||
lg | ||
} | ||
|
||
override clone() { | ||
val c = new CompositeTrack(); | ||
for (Track t : tracks) { | ||
c.tracks.add(t.clone()); | ||
} | ||
c | ||
} | ||
|
||
override write(JmeExporter ex) { | ||
val oc = ex.getCapsule(this); | ||
oc.write(tracks.toArray() as Track[], "tracks", null) | ||
} | ||
|
||
override read(JmeImporter im) { | ||
val ic = im.getCapsule(this); | ||
val ts = ic.readSavableArray("tracks", null) as Track[] | ||
if (ts != null) { | ||
tracks.addAll(ts) | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
jme3_xbuf_loader/src/main/java/jme3_ext_animation/CubicBezier.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package jme3_ext_animation | ||
|
||
/** | ||
* Some links: | ||
* | ||
* * [Bézier curve - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Animation) | ||
* * [In Python, given x-value on 2D Bezier Curve, return y-value - Blender Stack Exchange](http://blender.stackexchange.com/questions/8465/in-python-given-x-value-on-2d-bezier-curve-return-y-value) | ||
* * [java - Determining the real roots of a polynomial within a specific range - Stack Overflow](http://stackoverflow.com/questions/21869760/determining-the-real-roots-of-a-polynomial-within-a-specific-range) | ||
* * [Blender: curve.c](https://developer.blender.org/diffusion/B/browse/master/source/blender/blenkernel/intern/curve.c;7c9b1065895e0a6a12555075980d7a77d1dea8c7%241362) | ||
* * [javascript - y coordinate for a given x cubic bezier - Stack Overflow](http://stackoverflow.com/questions/7348009/y-coordinate-for-a-given-x-cubic-bezier) | ||
*/ | ||
class CubicBezier { | ||
|
||
/** | ||
* formula from http://blender.stackexchange.com/questions/6692/mathematical-formula-for-bezier-curves | ||
*/ | ||
static def bezier1D(float p0, float h0, float p1, float h1, float t) { | ||
val rt = 1 - t | ||
val rt2 = rt *rt | ||
val t2 = t * t | ||
rt * rt2 * p0 + 3 * rt2 * t * h0 + 3 * rt * t2 * h1 + t * t2 *p1 | ||
} | ||
|
||
/** | ||
* This method only work when bezier are curve where f(x) = y and y is unique (eg. when x is the timeline). | ||
* 1. search t from x by approximation (binary search) | ||
* 2. bezier(t).y | ||
* | ||
* @param x the target x from witch we search y | ||
* @param yp0 the y for p0 (xp0 = 0) | ||
* @param yp1 the y for p1 (xp1 = 1) | ||
* @param xh0 the x for handle h0 of p0 | ||
* @param yh0 the y for handle h0 of p0 | ||
* @param xh1 the x for handle h1 of p1 | ||
* @param yh1 the y for handle h1 of p1 | ||
* @param xTolerance the acceptable tolerance for x when searchint t (eg. 0.0001f) | ||
*/ | ||
static def float findYfromXBisec(float x, float yp0, float yp1, float xh0, float yh0, float xh1, float yh1, float xTolerance, int maxIteration ) { | ||
// we could do something less stupid, but since the x is monotonic | ||
// increasing given the problem constraints, we'll do a binary search. | ||
|
||
//establish bounds | ||
var lower = 0f | ||
var upper = 1f | ||
var t = (upper + lower) / 2f | ||
|
||
var xt = bezier1D(0, xh0, 1, xh1, t) | ||
|
||
|
||
for(var ite = maxIteration; Math.abs(x - xt) > xTolerance && ite > 0; ite--) { | ||
if(x > xt) { | ||
lower = t | ||
} else { | ||
upper = t | ||
} | ||
t = (upper + lower) / 2f | ||
xt = bezier1D(0, xh0, 1, xh1, t) | ||
} | ||
//we're within tolerance of the desired x value. | ||
//return the y value. | ||
bezier1D(yp0, yh0, yp1, yh1, t) | ||
} | ||
} |
Oops, something went wrong.