Skip to content

Commit

Permalink
Merge pull request #1 from svv2014/master
Browse files Browse the repository at this point in the history
pom.xml file added for support maven build and maven projects
  • Loading branch information
svv2014 committed Aug 21, 2015
2 parents ff10ee4 + 9475323 commit fdbeb52
Show file tree
Hide file tree
Showing 145 changed files with 7,494 additions and 2,769 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
/war/thothbot.*
/www-test
/gwt-unitCache
/.idea
/target
*.iml
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ which is Java to JavaScript cross-compiler. GWT allows developers to write Java
Parallax based on [three.js](http://github.com/mrdoob/three.js) project. The most methods and objects are equivalent three.js for the back compatibility.

The aim of the project is to use GWT which helps maintaining complex pieces of code, and provides better design-time support in IDEs like refactoring, validation, etc...<br/>
Parallax supports WebGL-canvas renderer only.

Parallax includes:
* WebGL renderer
* Raytracing renderer.

### Download - Parallax v1.3 ###
### Download - new Parallax v1.6 ###

[Download JAR](http://github.com/thothbot/parallax/wiki/Download) | [Change log](http://github.com/thothbot/parallax/wiki/Change-log)
[Download JAR](http://github.com/thothbot/parallax/wiki/Download) | [Change log](https://github.com/thothbot/parallax/releases)

### Examples ###

Expand Down
6 changes: 6 additions & 0 deletions javadoc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
<target name="javadoc">
<javadoc access="public" additionalparam=" -top &quot;&lt;script type='text/javascript'&gt; var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35732509-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); &lt;/script&gt;&quot;&#13;&#10;" author="true" classpath="C:\Soft\eclipse\plugins\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Soft\eclipse\plugins\org.junit_4.11.0.v201303080030\junit.jar;C:\Soft\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.6.0\gwt-2.6.0\gwt-user.jar;C:\Soft\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.6.0\gwt-2.6.0\validation-api-1.0.0.GA-sources.jar;C:\Soft\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.6.0\gwt-2.6.0\gwt-codeserver.jar;C:\Soft\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.6.0\gwt-2.6.0\gwt-dev.jar;C:\Soft\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.6.0\gwt-2.6.0\validation-api-1.0.0.GA.jar" destdir="doc" doctitle="Parallax 3D library API Reference" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="thothbot.parallax.plugins.sprite.shaders,thothbot.parallax.core.shared.core,thothbot.parallax.core.shared.lights,thothbot.parallax.plugins.lensflare,thothbot.parallax.core.shared.scenes,thothbot.parallax.core.shared.geometries,thothbot.parallax.core.client.gl2.extension,thothbot.parallax.core.shared.geometries.parametric,thothbot.parallax.core.shared.utils,thothbot.parallax.loader.shared.collada,thothbot.parallax.core.client.context,thothbot.parallax.core.shared.objects,thothbot.parallax.core.client,thothbot.parallax.core.shared.helpers,thothbot.parallax.core.shared.materials,thothbot.parallax.plugins.sprite,thothbot.parallax.core.client.textures,thothbot.parallax.plugins.postprocessing.shaders,thothbot.parallax.core.client.debugger,thothbot.parallax.core.shared.curves,thothbot.parallax.core.resources,thothbot.parallax.core.client.events,thothbot.parallax.core.client.gl2.enums,thothbot.parallax.core.client.gl2.arrays,thothbot.parallax.core.shared.math,thothbot.parallax.core.client.gl2,thothbot.parallax.loader.shared,thothbot.parallax.core.shared.cameras,thothbot.parallax.core.shared.curves.parametric,thothbot.parallax.plugins.lensflare.shaders,thothbot.parallax.core.client.controls,thothbot.parallax.core.shared,thothbot.parallax.plugins.postprocessing,thothbot.parallax.core.client.shaders,thothbot.parallax.loader.shared.json,thothbot.parallax.core.client.renderers" source="1.7" sourcepath="src" splitindex="true" use="true" version="true"/>
</target>
</project>
58 changes: 58 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>thothbot.parallax</groupId>
<artifactId>parallax</artifactId>
<packaging>jar</packaging>
<version>0.1-SNAPSHOT</version>
<name>parallax3d</name>

<properties>
<gwt.version>2.7.0</gwt.version>
</properties>

<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<localWorkers>2</localWorkers>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>

</project>
4 changes: 2 additions & 2 deletions src/thothbot/parallax/core/client/AnimatedScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static interface AnimationUpdateHandler
/**
* Called when {@link #onUpdate()} called.
*/
public void onUpdate();
public void onUpdate(double duration);
}

private RenderingPanel renderingPanel;
Expand Down Expand Up @@ -98,6 +98,6 @@ protected void onRefresh(double duration)
getRenderer().getInfo().getTimer().render = new Duration();
onUpdate(duration);

animationUpdateHandler.onUpdate();
animationUpdateHandler.onUpdate(duration);
}
}
74 changes: 43 additions & 31 deletions src/thothbot/parallax/core/client/RenderingPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import thothbot.parallax.core.client.context.Canvas3d;
import thothbot.parallax.core.client.context.Canvas3dAttributes;
import thothbot.parallax.core.client.context.Canvas3dException;
import thothbot.parallax.core.client.debugger.Debugger;
import thothbot.parallax.core.client.events.AnimationReadyEvent;
import thothbot.parallax.core.client.events.AnimationReadyHandler;
import thothbot.parallax.core.client.events.Context3dErrorEvent;
Expand All @@ -34,8 +33,8 @@
import thothbot.parallax.core.shared.Log;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerManager;
Expand All @@ -53,6 +52,11 @@
*/
public class RenderingPanel extends LayoutPanel implements IsWidget, HasWidgets, HasHandlers
{
public interface AnimationUpdateHandler
{
public void onUpdate(double duration);
}

// Sets the background color for the {@link Canvas3d}. Default: black (#000000).
private int clearColor = 0x000000;

Expand All @@ -64,16 +68,14 @@ public class RenderingPanel extends LayoutPanel implements IsWidget, HasWidgets,
private AnimatedScene animatedScene;
private HandlerManager handlerManager;
private boolean isLoaded = false;

// Debug panel
private boolean isDebugEnabled;
private Debugger debugger;

// Loading info panel
private boolean isSceneLoaded;

private Canvas3d canvas;
private WebGLRenderer renderer;

private AnimationUpdateHandler animationUpdateHandler;

/**
* This constructor will create new instance of the widget.
Expand Down Expand Up @@ -117,6 +119,11 @@ public AnimatedScene getAnimatedScene()
return this.animatedScene;
}

public void setAnimationUpdateHandler(AnimationUpdateHandler animationUpdateHandler)
{
this.animationUpdateHandler = animationUpdateHandler;
}

/**
* Sets the {@link AnimatedScene} to the widget.
* @param animatedScene
Expand All @@ -127,11 +134,6 @@ public void setAnimatedScene(AnimatedScene animatedScene)
handlerManager.fireEvent(new SceneLoadingEvent());
}

public void enableDebug(boolean enabled)
{
this.isDebugEnabled = enabled;
}

public void setBackground(int color)
{
setBackground(color, this.clearAlpha);
Expand Down Expand Up @@ -182,20 +184,6 @@ private Canvas3d loadCanvas() throws Exception

return canvas;
}

/**
* Load Debugger
*/
private void loadDebuger()
{
if(this.isDebugEnabled && this.debugger == null)
{
this.debugger = new Debugger(getRenderer().getInfo());
this.add(this.debugger);
this.setWidgetRightWidth(this.debugger, 1, Unit.PX, 17, Unit.EM);
this.setWidgetTopHeight(this.debugger, 1, Unit.PX, 50, Unit.PX);
}
}

/**
* This method is called when a widget is attached to the browser's document.
Expand Down Expand Up @@ -260,19 +248,17 @@ public void onLoaded()
this.animatedScene.init(this, new AnimatedScene.AnimationUpdateHandler() {

@Override
public void onUpdate()
public void onUpdate(double duration)
{

if(!isSceneLoaded)
{
handlerManager.fireEvent(new SceneLoadingEvent(true));
isSceneLoaded = true;

loadDebuger();
}

// Update debugger
if(debugger != null) debugger.update();
if(animationUpdateHandler != null)
animationUpdateHandler.onUpdate(duration);
}
});

Expand Down Expand Up @@ -353,4 +339,30 @@ private static String cssColor(int color)

return retval;
}

public void toFullScreen() {
RenderingPanel.toFullScreen(this.getElement());
}

private static native void toFullScreen(Element element) /*-{
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.mozRequestFullscreen) {
element.mozRequestFullScreen();
}
var rect = element.getBoundingClientRect();
element.width = rect.width;
element.height = rect.height;
}-*/;

public boolean isSupportFullScreen() {
return RenderingPanel.isSupportFullScreen(this.getElement());
}

private static native boolean isSupportFullScreen(Element element) /*-{
return (element.requestFullscreen || element.webkitRequestFullscreen || element.mozRequestFullscreen) ? true : false;
}-*/;
}
6 changes: 3 additions & 3 deletions src/thothbot/parallax/core/client/context/Canvas3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class Canvas3d extends FocusWidget
*/
public Canvas3d(Canvas3dAttributes attribs) throws Exception
{
canvas = Document.get().createElement("canvas").cast();
canvas = Document.get().createCanvasElement();
setElement(canvas);

for (final String contextId : CONTEXT_IDS)
{
try
Expand Down Expand Up @@ -77,7 +77,7 @@ private static native WebGLRenderingContext getContext(CanvasElement canvas, Str
JavaScriptObject glContextAttr) /*-{
return canvas.getContext(contextId, glContextAttr);
}-*/;

/**
* Gets the width of the canvas3d.
*/
Expand Down
Loading

0 comments on commit fdbeb52

Please sign in to comment.