Browse Source

Merge pull request #969 from AtomicGameEngine/TSH-ATOMIC-DTSUPDATES

Atomic.d.ts updates
JoshEngebretson 9 years ago
parent
commit
7840a602e0
2 changed files with 61 additions and 1 deletions
  1. 2 1
      Script/Packages/Atomic/Scene.json
  2. 59 0
      Script/TypeScript/AtomicWork.d.ts

+ 2 - 1
Script/Packages/Atomic/Scene.json

@@ -39,7 +39,8 @@
 			"getChildrenWithName(name:string, recursive?:boolean):Node[];",
 			"getChildrenWithComponent(componentType:string, recursive?:boolean):Node[];",
 			"getComponents(componentType?:string, recursive?:boolean):Component[];",
-			"getComponent<T extends Atomic.Component>(type: string): T;",
+			"getComponent<T extends Atomic.Component>(type: string, recursive?: boolean): T;",
+			"getParentComponent<T extends Atomic.Component>(type: string, fullTraversal?: boolean): T;",
 			"getChildAtIndex(index:number):Node;",
 			"createJSComponent(name:string, args?:{});",
 			"getJSComponent(name:string, recursive?:boolean): JSComponent;",

+ 59 - 0
Script/TypeScript/AtomicWork.d.ts

@@ -46,6 +46,65 @@ declare module Atomic {
 
     }
 
+    export interface Ray {
+        /** Ray origin */
+        origin: Atomic.Vector3;
+
+        /** Ray direction */
+        direction: Atomic.Vector3;
+    }
+
+    export interface Camera {
+        getScreenRay(x: number, y: number): Atomic.Ray;
+    }
+
+    export interface Octree {
+        /**
+         * Cast a ray returing a single hit
+         * @param  {Atomic.Ray} ray
+         * @param  {Atomic.RayQueryLevel} level defaults to Atomic.RAY_TRIANGLE
+         * @param  {number} maxDistance defaults to Atomic.M_INFINITY
+         * @param  {number} drawableFlags defaults to Atomic.DRAWABLE_ANY
+         * @param  {number} viewMask defaults to Atomic.DEFAULT_VIEWMASK
+         * @return {Atomic.RayQueryResult}
+         */
+        rayCastSingle(ray: Atomic.Ray, level?: Atomic.RayQueryLevel, maxDistance?: number, drawableFlags?: number, viewMask?: number):Atomic.RayQueryResult;
+
+        /**
+         * Cast a ray returning all hits
+         * @param  {Atomic.Ray} ray
+         * @param  {Atomic.RayQueryLevel} level defaults to Atomic.RAY_TRIANGLE
+         * @param  {number} maxDistance defaults to Atomic.M_INFINITY
+         * @param  {number} drawableFlags defaults to Atomic.DRAWABLE_ANY
+         * @param  {number} viewMask defaults to Atomic.DEFAULT_VIEWMASK
+         * @return {Atomic.RayQueryResult}
+         */
+        rayCast(ray: Atomic.Ray, level?: Atomic.RayQueryLevel, maxDistance?: number, drawableFlags?: number, viewMask?: number):Atomic.RayQueryResult[];
+    }
+
+    export interface RayQueryResult {
+        /** Hit position in world space. */
+        position: Atomic.Vector3;
+
+        /** Hit normal in world space. Negation of ray direction if per-triangle data not available. */
+        normal: Atomic.Vector3;
+
+        /** Hit texture position */
+        textureUV: Atomic.Vector2;
+
+        /** Distance from ray origin. */
+        distance:number;
+
+        /** Drawable. */
+        drawable: any;
+
+        /** Scene node. */
+        node: Atomic.Node;
+
+        /** Drawable specific subobject if applicable. */
+        subObject: number;
+    }
+
     export interface KeyDownEvent {
 
         // keycode