-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
107 additions
and
143 deletions.
There are no files selected for viewing
104 changes: 0 additions & 104 deletions
104
src/main/java/com/jme3/recast4j/demo/utils/GameObject.java
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
64 changes: 64 additions & 0 deletions
64
src/test/java/com/jme3/recast4j/demo/utils/GameObject.java
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,64 @@ | ||
package com.jme3.recast4j.demo.utils; | ||
|
||
import com.jme3.scene.Node; | ||
import com.jme3.scene.Spatial; | ||
import com.jme3.scene.control.Control; | ||
|
||
/** | ||
* | ||
* @author capdevon | ||
*/ | ||
public class GameObject { | ||
|
||
/** | ||
* A private constructor to inhibit instantiation of this class. | ||
*/ | ||
private GameObject() { | ||
} | ||
|
||
/** | ||
* Returns the component of Type type if the game object has one attached, null | ||
* if it doesn't. | ||
*/ | ||
public static <T extends Control> T getComponent(Spatial sp, Class<T> type) { | ||
return sp.getControl(type); | ||
} | ||
|
||
/** | ||
* Returns the component of Type type in the GameObject or any of its children | ||
* using depth first search. | ||
*/ | ||
public static <T extends Control> T getComponentInChildren(Spatial sp, final Class<T> type) { | ||
T control = sp.getControl(type); | ||
if (control != null) { | ||
return control; | ||
} | ||
|
||
if (sp instanceof Node) { | ||
for (Spatial child : ((Node) sp).getChildren()) { | ||
control = getComponentInChildren(child, type); | ||
if (control != null) { | ||
return control; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* Retrieves the component of Type type in the GameObject or any of its parents. | ||
*/ | ||
public static <T extends Control> T getComponentInParent(Spatial sp, Class<T> type) { | ||
Node parent = sp.getParent(); | ||
while (parent != null) { | ||
T control = parent.getControl(type); | ||
if (control != null) { | ||
return control; | ||
} | ||
parent = parent.getParent(); | ||
} | ||
return null; | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.