-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying Away3D + Starling interoperability, but it appears to be broken
Could be an issue with Away3D, Starling, OpenFL or Haxe - I've reported it on the discord. Will move on to just using Away3D for now instead
- Loading branch information
1 parent
f8aad7f
commit d398652
Showing
6 changed files
with
309 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,windows,linux,macos | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,windows,linux,macos | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### macOS Patch ### | ||
# iCloud generated files | ||
*.icloud | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
.vscode/settings.json | ||
.vscode/tasks.json | ||
.vscode/launch.json | ||
.vscode/extensions.json | ||
!.vscode/*.code-snippets | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# Built Visual Studio Code Extensions | ||
*.vsix | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
.ionide | ||
|
||
# Support for Project snippet scope | ||
.vscode/*.code-snippets | ||
|
||
# Ignore code-workspaces | ||
*.code-workspace | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,windows,linux,macos | ||
|
||
**/experiments/ | ||
**/bin/ | ||
|
||
# Created by the Haxe sometimes with compiler information | ||
**/dump/ | ||
|
||
# Generated translation strings | ||
**/*/generated_translation_strings.csv | ||
**/*/generated_translation_strings.json |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<project> | ||
<meta title="Radio Silence" package="com.distractionware.radiosilence" version="1.0.0" /> | ||
<app main="Main" file="radiosilence" path="bin" /> | ||
|
||
<window width="1280" height="720" | ||
orientation="landscape" | ||
vsync="true" fps="60" | ||
hardware="true" | ||
allow-shaders="true" | ||
require-shaders="true" | ||
depth-buffer="false" | ||
stencil-buffer="true" | ||
background="0x000000" /> | ||
|
||
<window orientation="landscape" vsync="false" antialiasing="0" if="cpp" /> | ||
|
||
<source path="src" /> | ||
|
||
<haxelib name="openfl" /> | ||
<haxelib name="starling" /> | ||
<haxelib name="away3d" /> | ||
|
||
<assets path="data" /> | ||
|
||
<config type="windows" output-directory="${platform}-${buildType}" /> | ||
</project> |
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,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<project version="2"> | ||
<!-- Output SWF options --> | ||
<output> | ||
<movie outputType="CustomBuild" /> | ||
<movie input="" /> | ||
<movie path="project.xml" /> | ||
<movie fps="30" /> | ||
<movie width="800" /> | ||
<movie height="600" /> | ||
<movie version="1" /> | ||
<movie minorVersion="0" /> | ||
<movie platform="Lime" /> | ||
<movie background="#FFFFFF" /> | ||
</output> | ||
<!-- Other classes to be compiled into your SWF --> | ||
<classpaths> | ||
<class path="C:\coding\haxelib\lime\8,0,2\src" /> | ||
<class path="C:\coding\haxelib\starling\git\src" /> | ||
<class path="C:\coding\haxelib\away3d\git" /> | ||
<class path="C:\coding\haxelib\openfl\9,2,2\src" /> | ||
<class path="src" /> | ||
<class path="bin\windows-release\haxe" /> | ||
</classpaths> | ||
<!-- Build options --> | ||
<build> | ||
<option directives="lime=8.0.2
starling=0.0.0
away3d=5.0.9
openfl=9.2.2
lime-harfbuzz
lime-openal
tools=8.0.2
lime-cairo
lime-opengl
no-compilation
native
lime-curl
lime-native
lime-vorbis
openfl-native
lime-cffi
fdb
windows
desktop" /> | ||
<option flashStrict="False" /> | ||
<option noInlineOnDebug="False" /> | ||
<option mainClass="ApplicationMain" /> | ||
<option enabledebug="False" /> | ||
<option additional="--macro lime._internal.macros.DefineMacro.run()
--macro openfl.utils._internal.ExtraParamsMacro.include()
--remap flash:openfl" /> | ||
</build> | ||
<!-- haxelib libraries --> | ||
<haxelib> | ||
<!-- example: <library name="..." /> --> | ||
</haxelib> | ||
<!-- Class files to compile (other referenced classes will automatically be included) --> | ||
<compileTargets> | ||
<!-- example: <compile path="..." /> --> | ||
</compileTargets> | ||
<!-- Paths to exclude from the Project Explorer tree --> | ||
<hiddenPaths> | ||
<hidden path="obj" /> | ||
</hiddenPaths> | ||
<!-- Executed before build --> | ||
<preBuildCommand>"$(CompilerPath)/haxelib" run lime build "$(OutputFile)" $(TargetBuild) -$(BuildConfig) -Dfdb</preBuildCommand> | ||
<!-- Executed after build --> | ||
<postBuildCommand alwaysRun="False" /> | ||
<!-- Other project options --> | ||
<options> | ||
<option showHiddenPaths="False" /> | ||
<option testMovie="Custom" /> | ||
<option testMovieCommand="" /> | ||
</options> | ||
<!-- Plugin storage --> | ||
<storage /> | ||
</project> |
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,88 @@ | ||
import away3d.containers.*; | ||
import away3d.entities.*; | ||
import away3d.materials.*; | ||
import away3d.primitives.*; | ||
import away3d.utils.*; | ||
import away3d.core.managers.Stage3DManager; | ||
import away3d.core.managers.Stage3DProxy; | ||
import away3d.events.Stage3DEvent; | ||
import away3d.debug.AwayStats; | ||
|
||
import openfl.display.*; | ||
import openfl.events.*; | ||
import openfl.geom.Vector3D; | ||
|
||
import starling.core.*; | ||
|
||
class Main extends Sprite { | ||
//engine variables | ||
private var stage3DManager:Stage3DManager; | ||
private var stage3DProxy:Stage3DProxy; | ||
private var away3dview:View3D; | ||
|
||
private var starlinglayer:Starling; | ||
|
||
//scene objects | ||
private var plane:Mesh; | ||
|
||
public function new(){ | ||
super(); | ||
|
||
stage.scaleMode = StageScaleMode.NO_SCALE; | ||
stage.align = StageAlign.TOP_LEFT; | ||
|
||
initProxies(); | ||
} | ||
|
||
private function initProxies() { | ||
// Define a new Stage3DManager for the Stage3D objects | ||
stage3DManager = Stage3DManager.getInstance(stage); | ||
|
||
// Create a new Stage3D proxy to contain the separate views | ||
stage3DProxy = stage3DManager.getFreeStage3DProxy(); | ||
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated); | ||
} | ||
|
||
private function onContextCreated(event:Stage3DEvent) { | ||
initAway3D(); | ||
initStarling(); | ||
|
||
//setup the render loop | ||
stage.addEventListener(Event.ENTER_FRAME, _onEnterFrame); | ||
} | ||
|
||
private function initAway3D(){ | ||
// Create the first Away3D view which holds the cube objects. | ||
away3dview = new View3D(); | ||
away3dview.stage3DProxy = stage3DProxy; | ||
away3dview.shareContext = true; | ||
|
||
//setup the camera | ||
away3dview.camera.z = -600; | ||
away3dview.camera.y = 500; | ||
away3dview.camera.lookAt(new Vector3D()); | ||
|
||
//setup the scene | ||
plane = new Mesh(new PlaneGeometry(700, 700), new TextureMaterial(Cast.bitmapTexture("data/floor_diffuse.jpg"))); | ||
away3dview.scene.addChild(plane); | ||
|
||
addChild(away3dview); | ||
addChild(new AwayStats(away3dview)); | ||
} | ||
|
||
private function initStarling(){ | ||
starlinglayer = new Starling(StarlingLayer, stage, stage3DProxy.viewPort, stage3DProxy.stage3D); | ||
} | ||
|
||
private function _onEnterFrame(e:Event) { | ||
//stage3DProxy.clear(0, 0, 0, 1, 1, 127); | ||
stage3DProxy.clear(); | ||
|
||
away3dview.render(); | ||
starlinglayer.nextFrame(); | ||
|
||
stage3DProxy.present(); | ||
|
||
plane.rotationY += 1; | ||
} | ||
} |
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,23 @@ | ||
import starling.display.Quad; | ||
import starling.display.Sprite; | ||
|
||
class StarlingLayer extends Sprite{ | ||
private static var _instance:StarlingLayer; | ||
|
||
public static function getInstance():StarlingLayer{ | ||
return _instance; | ||
} | ||
|
||
private var testquad:Quad; | ||
|
||
public function StarlingLayer(){ | ||
_instance = this; | ||
|
||
testquad = new Quad(500, 500, 0xFF0000); | ||
addChild(testquad); | ||
} | ||
|
||
public function update(){ | ||
//testquad.rotation += 0.005; | ||
} | ||
} |