Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1e7735a
Initial Stage3D Stuff
Fancy2209 Sep 10, 2024
2279ccd
Add Stage3D to SecurityDomain
Fancy2209 Sep 10, 2024
6e6fdf8
Commit Progress
Fancy2209 Sep 10, 2024
daacfbb
Consitency Fix
Fancy2209 Sep 10, 2024
4a6bb53
Add comment to remind myself
Fancy2209 Sep 10, 2024
25d1642
Fixed by eslint
Fancy2209 Sep 10, 2024
ba39199
Fix requested Context Profile and Minor Fixes
Fancy2209 Sep 10, 2024
fbaa722
Comit current work
Fancy2209 Sep 10, 2024
e617231
Update Stage.ts
Fancy2209 Sep 11, 2024
8b681de
Commit work
Fancy2209 Sep 11, 2024
d7dd603
Commit Work
Fancy2209 Sep 11, 2024
f12e88d
Commit work
Fancy2209 Sep 11, 2024
eaee8aa
Vectors suck
Fancy2209 Sep 11, 2024
22ea7bf
it almost works?
Fancy2209 Sep 12, 2024
e619ab5
Commit work
Fancy2209 Sep 13, 2024
2fca847
Fix
Fancy2209 Sep 13, 2024
84d345a
fix
Fancy2209 Sep 13, 2024
d5d1219
Temp Prog 3D Fix
Fancy2209 Sep 14, 2024
f197005
Fix DataPerVertex in VertexBuffer & Fixed by eslint
Fancy2209 Sep 16, 2024
8bf2f0b
Add Missing classes from shumway and temp fix for setProgramConstants…
Fancy2209 Sep 16, 2024
deca0b3
forgot to comm some changes
Fancy2209 Sep 16, 2024
fe93028
Add missing Context3D Getters and fix some oversights
Fancy2209 Sep 17, 2024
5f480d5
Cleanup
Fancy2209 Sep 17, 2024
60241bf
check event
Fancy2209 Sep 17, 2024
50dce41
Listen dor events
Fancy2209 Sep 17, 2024
2aa4fae
Minor Fix
Fancy2209 Sep 20, 2024
8358b1b
Implement Binary URLLoader
Fancy2209 Sep 23, 2024
4adeecf
Fix flash.system.Capabilities.version
Fancy2209 Sep 23, 2024
e0dd64a
Implement Textures
Fancy2209 Sep 23, 2024
56b1ee9
Ignore Mips for now, ignore setVertexBufferAt if no Program is set, p…
Fancy2209 Sep 23, 2024
4864750
Fix based on stage change
Fancy2209 Sep 24, 2024
bf7d0f9
Revert Null Fix (Didn't work, just made nothing render)
Fancy2209 Sep 24, 2024
a599281
Fix null stuff
Fancy2209 Sep 24, 2024
311bfee
Additional null fix
Fancy2209 Sep 24, 2024
d20d8cb
Final fix for Null setVertexAt (for now)
Fancy2209 Sep 24, 2024
ff148aa
Make requestContext3D async (doesn't fix all starling issues)
Fancy2209 Sep 30, 2024
6e477e4
Fix LoaderInfo.UncaughtErrorEvents
Fancy2209 Sep 30, 2024
0e5d7e9
Fix contentScaleFactor (0 breaks stuff who checks it)
Fancy2209 Sep 30, 2024
2992d0f
Comit work, fix WebPack without dist
Fancy2209 Oct 3, 2024
8d52737
Update Stage3D.ts
Fancy2209 Jan 29, 2025
5065eb9
Update link.ts
Fancy2209 Jan 29, 2025
b6f097a
Update link.ts
Fancy2209 Jan 29, 2025
711cefc
Update link.ts
Fancy2209 Jan 29, 2025
6e6ff9c
Remove unrelated changes and fix some vars that were lets
Fancy2209 Mar 27, 2025
6f5d57c
Fixup + Fixed by eslint
Fancy2209 Mar 28, 2025
4674698
Dispatch event every time the context is recreated
Fancy2209 Mar 28, 2025
b413598
Fix mistakes when rebasing
Fancy2209 Oct 8, 2025
c67b460
Add missing breaks to Context3D.setCulling()
Fancy2209 Oct 8, 2025
418e85a
Fix Sending Constants
Fancy2209 Oct 8, 2025
2106034
Properly separate fragment and vertex constants
Fancy2209 Oct 8, 2025
9f7810c
Add transposed matrix support to Context3D.uploadConstantsFromMatrix()
Fancy2209 Oct 9, 2025
a29d22f
Fix if in setProgramConstantsFromMatrix
Fancy2209 Oct 9, 2025
20ec402
Fix setProgramConstantsFromVector and cleanUp
Fancy2209 Oct 9, 2025
557910c
Update Matrix3D.ts
Fancy2209 Oct 10, 2025
10ee0eb
Cleanup Context3D.ts
Fancy2209 Oct 10, 2025
8f63774
Stub Matrix3D::recompose again
Fancy2209 Oct 14, 2025
86a28fb
Fix typo
Fancy2209 Oct 14, 2025
17447ad
Simplify setProgramConstantsFromMatrix. fix Matrix3D.recompose and ad…
Fancy2209 Oct 14, 2025
071855c
Merge branch 'dev' into stage3d
Fancy2209 Aug 3, 2026
d7f2070
Update Stage.ts
Fancy2209 Aug 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ npm-debug.log

# Misc
deploy_key
deploy_key.pub
deploy_key.pub
.vscode/settings.json
22 changes: 22 additions & 0 deletions lib/SecurityDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EventDispatcher } from './events/EventDispatcher';
import { DisplayObject } from './display/DisplayObject';
import { DisplayObjectContainer } from './display/DisplayObjectContainer';
import { Stage } from './display/Stage';
import { Stage3D } from './display/Stage3D';
import { Loader } from './display/Loader';
import { LoaderInfo } from './display/LoaderInfo';
import { MovieClip } from './display/MovieClip';
Expand Down Expand Up @@ -77,6 +78,14 @@ import { FocusEvent } from './events/FocusEvent';
import { UncaughtErrorEvents } from './events/UncaughtErrorEvents';
import { NetConnection } from './net/NetConnection';
import { Responder } from './net/Responder';
import { Context3D } from './display3D/Context3D';
import { IndexBuffer3D } from './display3D/IndexBuffer3D';
import { Program3D } from './display3D/Program3D';
import { VertexBuffer3D } from './display3D/VertexBuffer3D';
import { TextureBase } from './display3D/textures/TextureBase';
import { Texture } from './display3D/textures/Texture';
import { CubeTexture } from './display3D/textures/CubeTexture';
import { RectangleTexture } from './display3D/textures/RectangleTexture';

export class Mouse {}

Expand All @@ -87,6 +96,7 @@ export class SecurityDomain extends AXSecurityDomain {
DisplayObject: DisplayObject,
DisplayObjectContainer: DisplayObjectContainer,
Stage: Stage,
Stage3D: Stage3D,
Loader: Loader,
LoaderInfo: LoaderInfo,
MovieClip: MovieClip,
Expand All @@ -98,6 +108,18 @@ export class SecurityDomain extends AXSecurityDomain {
Shape: Shape,
FrameLabel: FrameLabel
},
display3D: {
Context3D: Context3D,
IndexBuffer3D: IndexBuffer3D,
Program3D: Program3D,
VertexBuffer3D: VertexBuffer3D,
textures: {
TextureBase: TextureBase,
Texture: Texture,
RectangleTexture: RectangleTexture,
CubeTexture: CubeTexture,
}
},
events: {
EventDispatcher: EventDispatcher,
Event: Event,
Expand Down
18 changes: 11 additions & 7 deletions lib/display/Stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import { Loader as PlayerGlobalLoader } from './Loader';
import { LoaderInfo, LoaderInfoCompleteQueue } from './LoaderInfo';
import { Debug } from '@awayjs/core';
import { InteractiveObject } from './InteractiveObject';
import { StageManager } from '@awayjs/stage';
import { GenericVector } from '@awayfl/avm2';
import { Stage3D } from './Stage3D';

/**
* Dispatched by the Stage object when the state of the stageVideos property changes.
Expand Down Expand Up @@ -153,7 +156,7 @@ import { InteractiveObject } from './InteractiveObject';

export class Stage extends DisplayObjectContainer {

private _stage3Ds: AwayStage[];
private _stage3Ds: GenericVector;

private _sendEventRender: boolean;

Expand All @@ -162,7 +165,10 @@ export class Stage extends DisplayObjectContainer {

this._isStage = true;

this._stage3Ds = [];
this._stage3Ds = new (<SecurityDomain> this.sec).ObjectVector();
for (let i: number = 0; i < AVMStage.instance().stage3Ds.length; i++) {
this._stage3Ds.axSetNumericProperty(i, new (<SecurityDomain> this.sec).flash.display.Stage3D(i));
}

// resize event listens on window
this._resizeCallbackDelegate = (event: any) => this.resizeCallback(event);
Expand Down Expand Up @@ -476,7 +482,7 @@ export class Stage extends DisplayObjectContainer {
public get contentsScaleFactor (): number {
// @todo
Debug.throwPIR('playerglobals/display/Stage', 'get contentsScaleFactor', '');
return 0;
return 1;
}

public get displayContextInfo (): string {
Expand Down Expand Up @@ -805,9 +811,7 @@ export class Stage extends DisplayObjectContainer {

}

public get stage3Ds (): AwayStage[] {
// @todo
Debug.throwPIR('playerglobals/display/Stage', 'get stage3Ds', '');
public get stage3Ds (): GenericVector {
return this._stage3Ds;
}

Expand Down Expand Up @@ -1140,4 +1144,4 @@ export class Stage extends DisplayObjectContainer {
return false;
}

}
}
102 changes: 102 additions & 0 deletions lib/display/Stage3D.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { AVMStage } from '@awayfl/swf-loader';
import { ContextGLProfile, Stage as AwayStage } from '@awayjs/stage';
import { Context3D } from '../display3D/Context3D';
import { Event } from '../events/Event';
import { EventDispatcher } from '../events/EventDispatcher';
import { SecurityDomain } from '../SecurityDomain';
import { AXSecurityDomain } from '@awayfl/avm2';
import { ErrorEvent } from '../events/ErrorEvent';

export class Stage3D extends EventDispatcher {
// Called whenever the class is initialized.
public static classInitializer: any = null;

// List of static symbols to link.
public static classSymbols: string[] = null; // [];

// List of instance symbols to link.
public static instanceSymbols: string[] = null; // [];
private _context3D: Context3D
private _adaptee: AwayStage

constructor(i) {
super();
console.log('Stage3D Constructor');
this._adaptee = AVMStage.instance().stage3Ds[i];
}

public get adaptee(): AwayStage {
return this._adaptee;
}

public get x(): number {
return this._adaptee.x;
}

public set x(value: number) {
this._adaptee.y = value;
}

public get y(): number {
return this._adaptee.y;
}

public set y(value: number) {
this._adaptee.y = value;
}

public get visible(): boolean {
return this._adaptee.visible ;
}

public set visible(value: boolean) {
this._adaptee.visible = value;
}

public get context3D(): Context3D {
return this._context3D;
}

public requestContext3D(context3DRenderMode: string = 'auto', profile: string = 'baseline'): void {
this._context3D = new (this.sec as SecurityDomain).flash.display3D.Context3D(this, context3DRenderMode, profile);

const dispatchContextCreated = (e: Event) => {
this._context3D.removeEventListener(Event.CONTEXT3D_CREATE, dispatchContextCreated);
this.dispatchEvent(new (<SecurityDomain>this.sec).flash.events.Event(Event.CONTEXT3D_CREATE));
}

this._context3D.addEventListener(Event.CONTEXT3D_CREATE, dispatchContextCreated);
setTimeout(() => {
console.log('Request Context');
const forceSoftware: boolean = (context3DRenderMode == 'software');
let awayContextProfile: ContextGLProfile = ContextGLProfile.BASELINE;
switch (profile) {
case 'baseline':
awayContextProfile = ContextGLProfile.BASELINE;
break;
case 'baseline_constrained':
awayContextProfile = ContextGLProfile.BASELINE_CONSTRAINED;
break;
case 'baseline_extended':
awayContextProfile = ContextGLProfile.BASELINE_EXTENDED;
break;
case 'standard':
awayContextProfile = ContextGLProfile.STANDARD;
break;
case 'standard_constrained':
awayContextProfile = ContextGLProfile.STANDARD_CONSTRAINED;
break;
case 'standard_extended':
awayContextProfile = ContextGLProfile.STANDARD_EXTENDED;
break;
case 'enhanced':
awayContextProfile = ContextGLProfile.BASELINE_EXTENDED;
break;
default:
break;
}
console.log('Context3D Config: ', 'forceSoftware: ', forceSoftware, ' profile: ', profile);
this._adaptee.requestContext(forceSoftware, awayContextProfile);
} , 0);
}
}
Loading