本文整理汇总了Java中com.sun.j3d.loaders.Scene类的典型用法代码示例。如果您正苦于以下问题:Java Scene类的具体用法?Java Scene怎么用?Java Scene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scene类属于com.sun.j3d.loaders包,在下文中一共展示了Scene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Returns the scene described in the given 3DS file.
*/
public Scene load(String file) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException
{
URL baseUrl;
try
{
if (this.basePath != null)
{
baseUrl = new File(this.basePath).toURI().toURL();
}
else
{
baseUrl = new File(file).toURI().toURL();
}
}
catch (MalformedURLException ex)
{
throw new FileNotFoundException(file);
}
return load(new FileInputStream(file), baseUrl);
}
示例2: load
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Returns the scene described in the given DAE file.
*/
public Scene load(String file) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException
{
URL baseUrl;
try
{
if (this.basePath != null)
{
baseUrl = new File(this.basePath).toURI().toURL();
}
else
{
baseUrl = new File(file).toURI().toURL();
}
}
catch (MalformedURLException ex)
{
throw new FileNotFoundException(file);
}
return load(new BufferedInputStream(new FileInputStream(file)), baseUrl);
}
示例3: setupLighting
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Setup the worlds lighting. If none is provided in the VRML file then
* we create a simple headlight
*
* @param scene The scene to source the lights from
*/
private void setupLighting(Scene scene) {
Light lights[] = scene.getLightNodes();
if (lights == null) {
BranchGroup lightBG = new BranchGroup();
BoundingSphere lightBounds =
new BoundingSphere(new Point3d(), Double.MAX_VALUE);
DirectionalLight headLight =
new DirectionalLight(new Color3f(1.0f,1.0f,1.0f),
new Vector3f(0,0,-1));
headLight.setCapability(Light.ALLOW_STATE_WRITE);
headLight.setInfluencingBounds(lightBounds);
lightBG.addChild(headLight);
sceneRoot.addChild(lightBG);
}
}
示例4: load
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Load a scene from the given filename. The scene instance returned by
* this builder will not have had any external references resolved.
* Externprotos, scripts, Inlines and all other nodes that reference part
* of their data as a URL will need to be loaded separately.
*
* @param filename The name of the file to load
* @return A description of the scene
* @throws FileNotFoundException The reader can't find the file
* @throws IncorrectFormatException The file is not one our loader
* understands (VRML 1.0 or X3D content)
* @throws ParsingErrorException An error parsing the file
*/
public Scene load(String filename)
throws FileNotFoundException,
IncorrectFormatException,
ParsingErrorException {
File file = new File(filename);
if(!file.exists())
throw new FileNotFoundException("File does not exist");
if(file.isDirectory())
throw new FileNotFoundException("File is a directory");
InputSource is = new InputSource(file);
return load(is);
}
示例5: succeeded
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
@Override
protected void succeeded(Scene result) {
NeuGenView ngView = NeuGenView.getInstance();
ngView.setScene(s);
ngView.enableButtons();
System.gc();
ngView.outPrintln(Utils.getMemoryStatus());
if (ngView.visualizeData() == null) {
logger.info("is null!");
}
ngView.visualizeData().run();
}
示例6: loadScene
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
private Scene loadScene() throws FileNotFoundException {
IfcScene result;
try {
result = new IfcScene();
SceneManager<E,BranchGroup> sceneManager = mapper.map(configuration);
mapper = null; // release resources
result.setSceneGroup(sceneManager.getScene());
sceneManager.animate();
} catch (TargetCreationException e) {
throw new ParsingErrorException(e.getMessage());
}
return result;
}
示例7: loadWavefrontObject
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Chargement de l'objet Wavefront (masque.obj) ainsi que les materiaux qui
* lui sont associes
*
* @param filename nom du fichier de l'objet a charger
* @return BranchGroup branch group contenant l'objet Wavefront
*/
private static BranchGroup loadWavefrontObject(String filename) {
ObjectFile waveFrontObject = new ObjectFile();
Scene scene = null;
try {
scene = waveFrontObject.load(filename);
BranchGroup bg = scene.getSceneGroup();
return bg;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例8: parseStream
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Returns the scene with data read from the given 3DS stream.
*/
private Scene parseStream(ChunksInputStream in) throws IOException
{
this.masterScale = 1;
this.meshes = new ArrayList<Mesh3DS>();
this.materials = new LinkedHashMap<String, Material3DS>();
this.meshesGroups = new HashMap<String, List<TransformGroup>>();
boolean magicNumberRead = false;
switch (in.readChunkHeader().getID())
{
case M3DMAGIC:
case MLIBMAGIC:
case CMAGIC:
magicNumberRead = true;
while (!in.isChunckEndReached())
{
switch (in.readChunkHeader().getID())
{
case M3D_VERSION:
in.readLittleEndianUnsignedInt();
break;
case EDITOR_DATA:
parseEditorData(in);
break;
case KEY_FRAMER_DATA:
parseKeyFramerData(in);
break;
default:
in.readUntilChunkEnd();
break;
}
in.releaseChunk();
}
break;
case EDITOR_DATA:
parseEditorData(in);
break;
default:
if (magicNumberRead)
{
in.readUntilChunkEnd();
}
else
{
throw new IncorrectFormatException("Bad magic number");
}
}
in.releaseChunk();
try
{
return createScene();
}
finally
{
this.meshes = null;
this.materials = null;
this.meshesGroups = null;
this.root = null;
}
}
示例9: load
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Returns the scene described in the given OBJ file stream.
*/
public Scene load(Reader reader) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException
{
return load(reader, null);
}
示例10: parseObjectStream
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Returns the scene parsed from a stream.
*/
private Scene parseObjectStream(Reader reader, URL baseUrl) throws IOException
{
this.vertices = new ArrayList<Point3f>();
this.textureCoordinates = new ArrayList<TexCoord2f>();
this.normals = new ArrayList<Vector3f>();
this.groups = new LinkedHashMap<String, Group>();
this.currentGroup = new Group("default");
this.groups.put("default", this.currentGroup);
this.currentMaterial = "default";
this.appearances = new HashMap<String, Appearance>(DEFAULT_APPEARANCES);
StreamTokenizer tokenizer = createTokenizer(reader);
while (tokenizer.nextToken() != StreamTokenizer.TT_EOF)
{
switch (tokenizer.ttype)
{
case StreamTokenizer.TT_WORD:
parseObjectLine(tokenizer, baseUrl);
break;
case StreamTokenizer.TT_EOL:
break;
default:
throw new IncorrectFormatException(
"Unexpected token " + tokenizer.sval + " at row " + tokenizer.lineno());
}
}
try
{
return createScene();
}
finally
{
this.vertices = null;
this.textureCoordinates = null;
this.normals = null;
this.groups = null;
this.appearances = null;
}
}
示例11: getScene
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public Scene getScene() {
return s;
}
示例12: setScene
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public void setScene(Scene scene) {
this.scene = scene;
}
示例13: VisualizationTask
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public VisualizationTask(Application application, Visualization vis, Scene s) {
super(application);
this.vis = vis;
this.s = s;
}
示例14: load
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public Scene load(Reader reader) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException {
throw new UnsupportedOperationException();
}
示例15: loadFile
import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
* Load the given file into the scene.
*
* @param filename The name of the file or the URL to load
*/
private void loadFile(String file) {
int flag = VRML97Loader.LOAD_ALL;
if(staticLoad)
flag &= ~VRML97Loader.LOAD_BEHAVIOR_NODES;
VRML97Loader loader = new VRML97Loader(flag);
// if the file is a directory, ignore it
File f = new File(file);
if(f.exists() && !f.isFile()) {
System.out.println("Can't load directories specified");
System.exit(1);
}
URL url = null;
Scene scene = null;
try {
url = new URL(file);
} catch (MalformedURLException badUrl) {
// if the location is not a URL, this is what you get
}
try {
if(url != null)
scene = loader.load(url);
else
scene = loader.load(file);
} catch(Exception e) {
System.out.println("Exception loading URL:" + e);
e.printStackTrace();
System.exit(0);
}
urlLabel.setText("File " + file);
if (scene != null) {
// get the scene group
sceneGroup = scene.getSceneGroup();
sceneGroup.setCapability(BranchGroup.ALLOW_DETACH);
sceneGroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
sceneGroup.compile();
// add the scene group to the scene
examineGroup.addChild(sceneGroup);
// now that the scene group is "live" we can inquire the bounds
setViewpoint();
setupLighting(scene);
}
}