• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Scene类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.j3d.loaders.Scene的典型用法代码示例。如果您正苦于以下问题:Java Scene类的具体用法?Java Scene怎么用?Java Scene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Scene类属于com.sun.j3d.loaders包,在下文中一共展示了Scene类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:24,代码来源:Max3DSLoader.java


示例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);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:24,代码来源:DAELoader.java


示例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);
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:24,代码来源:Java3DLoaderDemo.java


示例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);
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:31,代码来源:BaseLoader.java


示例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();
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:13,代码来源:OBJReader.java


示例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;
}
 
开发者ID:hlg,项目名称:billie,代码行数:14,代码来源:MappedJ3DLoader.java


示例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;

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:29,代码来源:ManagerObj.java


示例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;
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:65,代码来源:Max3DSLoader.java


示例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);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:8,代码来源:OBJLoader.java


示例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;
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:44,代码来源:OBJLoader.java


示例11: getScene

import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public Scene getScene() {
    return s;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:4,代码来源:OBJReader.java


示例12: setScene

import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public void setScene(Scene scene) {
    this.scene = scene;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:4,代码来源:NeuGenView.java


示例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;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:6,代码来源:VisualizationTask.java


示例14: load

import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public Scene load(Reader reader) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException {
    throw new UnsupportedOperationException();
}
 
开发者ID:hlg,项目名称:billie,代码行数:4,代码来源:MappedJ3DLoader.java


示例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);
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:59,代码来源:Java3DLoaderDemo.java


示例16: Loader3D

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 Loader3D(String filename) {

  Loader3DS d = new Loader3DS();

  if (!Manager3DS.TEXTURED) {
    d.noTextures();
  }

  Scene scene = null;

  try {
    String path = filename;

    scene = d.load(path);

    BranchGroup bg = scene.getSceneGroup();

    return bg;

  } catch (Exception e) {
    System.out.println(filename);
    e.printStackTrace();
  }

  return null;

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:35,代码来源:Manager3DS.java


示例17: ObjectLoader

import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
public ObjectLoader() {

		setLayout(new BorderLayout());
		GraphicsConfiguration graphicsConfig = SimpleUniverse
				.getPreferredConfiguration();

		Canvas3D canvas3D = new Canvas3D(graphicsConfig);
		add(canvas3D);
		canvas3D.setSize(1200, 800);
		canvas3D.setVisible(true);

		BranchGroup scene = new BranchGroup();

		ObjectFile loader = new ObjectFile(ObjectFile.LOAD_ALL);
		loader.setFlags(ObjectFile.RESIZE);

		Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);

		BoundingSphere bounds =

		new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

		Vector3f light1Direction = new Vector3f(2.0f, 12.0f, -12.0f);

		DirectionalLight light1

		= new DirectionalLight(light1Color, light1Direction);

		light1.setInfluencingBounds(bounds);

		scene.addChild(light1);

		Scene modelScene = null;

		try {
			modelScene = loader.load("Images/gargoyle.obj");

		} catch (Exception e) {

		}

		scene.addChild(modelScene.getSceneGroup());

		SimpleUniverse universe = new SimpleUniverse(canvas3D);
		universe.getViewingPlatform().setNominalViewingTransform();

		universe.addBranchGraph(scene);
		
		ViewingPlatform viewPlatform = universe.getViewingPlatform();
	    TransformGroup viewTransform = viewPlatform.getViewPlatformTransform();
	    Transform3D t3d = new Transform3D();
	    viewTransform.getTransform(t3d);
	    t3d.lookAt(new Point3d(0, 0, 4), new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
	    t3d.invert();
	    viewTransform.setTransform(t3d);

	}
 
开发者ID:GettingNifty,项目名称:Heavy-Evil,代码行数:58,代码来源:ObjectLoader.java


示例18: modelFromFile

import com.sun.j3d.loaders.Scene; //导入依赖的package包/类
/**
 * Helper method to create model from .obj file.
 *
 * @param modelFile file name
 * @throws java.io.FileNotFoundException
 */
protected void modelFromFile(String modelFile) throws FileNotFoundException {
    ObjectFile objectFile = new ObjectFile();
    Scene scene = objectFile.load(modelFile);
    transformGroup.addChild(scene.getSceneGroup());
}
 
开发者ID:DrTon,项目名称:jMAVSim,代码行数:12,代码来源:KinematicObject.java



注:本文中的com.sun.j3d.loaders.Scene类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AppAttemptInfo类代码示例发布时间:2022-05-22
下一篇:
Java WindowEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap