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

Java TextureCubeMap类代码示例

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

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



TextureCubeMap类属于com.jme3.texture包,在下文中一共展示了TextureCubeMap类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupSkyBox

import com.jme3.texture.TextureCubeMap; //导入依赖的package包/类
private void setupSkyBox() {
    Mesh sphere = new Sphere(32, 32, 10f);
    sphere.setStatic();
    skyBox = new Geometry("SkyBox", sphere);
    skyBox.setQueueBucket(Bucket.Sky);
    skyBox.setShadowMode(ShadowMode.Off);

    Image cube = SceneApplication.getApplication().getAssetManager().loadTexture("Textures/blue-glow-1024.dds").getImage();
    TextureCubeMap cubemap = new TextureCubeMap(cube);

    Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Sky.j3md");
    mat.setBoolean("SphereMap", false);
    mat.setTexture("Texture", cubemap);
    mat.setVector3("NormalScale", new Vector3f(1, 1, 1));
    skyBox.setMaterial(mat);

    ((Node) SceneApplication.getApplication().getViewPort().getScenes().get(0)).attachChild(skyBox);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:19,代码来源:WelcomeScreen.java


示例2: createSky

import com.jme3.texture.TextureCubeMap; //导入依赖的package包/类
/**
 * Create a cube-mapped sky using six textures.
 *
 * @param assetManager from which to load materials
 * @param west         texture for the western face of the cube
 * @param east         texture for the eastern face of the cube
 * @param north        texture for the northern face of the cube
 * @param south        texture for the southern face of the cube
 * @param up           texture for the top face of the cube
 * @param down         texture for the bottom face of the cube
 * @param normalScale  The normal scale is multiplied by the 3D normal to get
 *                     a texture coordinate. Use Vector3f.UNIT_XYZ to not apply and
 *                     transformation to the normal.
 * @param sphereRadius the sky sphere's radius: for the sky to be visible,
 *                     its radius must fall between the near and far planes of the camera's
 *                     frustrum
 * @return a new spatial representing the sky, ready to be attached to the
 * scene graph
 */
public static @NotNull Spatial createSky(@NotNull final AssetManager assetManager, @NotNull final Texture west,
                                         @NotNull final Texture east, @NotNull final Texture north,
                                         @NotNull final Texture south, @NotNull final Texture up,
                                         @NotNull final Texture down, @NotNull final Vector3f normalScale,
                                         float sphereRadius) {

    Image westImg = west.getImage();
    Image eastImg = east.getImage();
    Image northImg = north.getImage();
    Image southImg = south.getImage();
    Image upImg = up.getImage();
    Image downImg = down.getImage();

    checkImagesForCubeMap(westImg, eastImg, northImg, southImg, upImg, downImg);

    Image cubeImage = new Image(westImg.getFormat(), westImg.getWidth(), westImg.getHeight(), null, westImg.getColorSpace());
    cubeImage.addData(westImg.getData(0));
    cubeImage.addData(eastImg.getData(0));
    cubeImage.addData(downImg.getData(0));
    cubeImage.addData(upImg.getData(0));
    cubeImage.addData(southImg.getData(0));
    cubeImage.addData(northImg.getData(0));

    TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
    return createSky(assetManager, cubeMap, normalScale, SkyFactory.EnvMapType.CubeMap, sphereRadius);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:46,代码来源:JmbSkyFactory.java


示例3: SkySpatial

import com.jme3.texture.TextureCubeMap; //导入依赖的package包/类
public SkySpatial(
		SkyComponent skyComponent,
		JmeResourceManager resourceManager,
		AssetManager assetManager) {
	super(
			skyComponent.getName(),
			(float)skyComponent.getOrder(),
			resourceManager,
			assetManager);
	
	setCullHint(Spatial.CullHint.Never);
	setQueueBucket(Bucket.Sky);
	
	texture = new TextureCubeMap();
	texture.setMagFilter(Texture.MagFilter.Nearest);
	texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	texture.setAnisotropicFilter(0);
	texture.setWrap(Texture.WrapMode.EdgeClamp);
	
	material = new Material(assetManager, "/assets/shaders/sky/Sky.j3md");
	material.setVector4("Color", new Vector4f(0.0f, 0.0f, 0.0f, 0.0f));
	material.setInt("ColorBlendMode", ShaderUtil.getColorBlendModeAsInteger(ColorBlendMode.NORMAL));
	material.setVector3("NormalScale", Vector3f.UNIT_XYZ);
	material.setTexture("Texture", texture);
	material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
	
	sphere = new Sphere(8, 8, 10, false, true);
	
	geometry = new Geometry();
	geometry.setMaterial(material);
	geometry.setMesh(sphere);
	geometry.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
	
	attachChild(geometry);
	
	addControl(new CameraAttachingControl());
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:38,代码来源:SkySpatial.java


示例4: createSky

import com.jme3.texture.TextureCubeMap; //导入依赖的package包/类
public static Spatial createSky(AssetManager assetManager, Texture west, Texture east, Texture north, Texture south, Texture up, Texture down, Vector3f normalScale){
    Geometry sky = new Geometry("Sky", sphereMesh);
    sky.setQueueBucket(Bucket.Sky);
    sky.setCullHint(Spatial.CullHint.Never);

    Image westImg  = west.getImage();
    Image eastImg  = east.getImage();
    Image northImg = north.getImage();
    Image southImg = south.getImage();
    Image upImg    = up.getImage();
    Image downImg  = down.getImage();

    checkImagesForCubeMap(westImg, eastImg, northImg, southImg, upImg, downImg);

    Image cubeImage = new Image(westImg.getFormat(), westImg.getWidth(), westImg.getHeight(), null);
    
    cubeImage.addData(westImg.getData(0));
    cubeImage.addData(eastImg.getData(0));
    
    cubeImage.addData(downImg.getData(0));
    cubeImage.addData(upImg.getData(0));

    cubeImage.addData(southImg.getData(0));
    cubeImage.addData(northImg.getData(0));

    TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
    cubeMap.setAnisotropicFilter(0);
    cubeMap.setMagFilter(Texture.MagFilter.Bilinear);
    cubeMap.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
    cubeMap.setWrap(Texture.WrapMode.EdgeClamp);

    Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    skyMat.setTexture("Texture", cubeMap);
    skyMat.setVector3("NormalScale", normalScale);
    sky.setMaterial(skyMat);

    return sky;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:SkyFactory.java


示例5: setupOffscreenView

import com.jme3.texture.TextureCubeMap; //导入依赖的package包/类
public Texture setupOffscreenView(){
    Camera offCamera = new Camera(512, 512);
 
    offView = renderManager.createPreView("Offscreen View", offCamera);
    offView.setClearFlags(true, true, true);
    offView.setBackgroundColor(ColorRGBA.DarkGray);
 
    // create offscreen framebuffer
    FrameBuffer offBuffer = new FrameBuffer(512, 512, 1);
 
    //setup framebuffer's cam
    offCamera.setFrustumPerspective(45f, 1f, 1f, 1000f);
    offCamera.setLocation(new Vector3f(0f, 0f, -5f));
    offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
 
    //setup framebuffer's texture
    TextureCubeMap offTex = new TextureCubeMap(512, 512, Format.RGBA8);
    offTex.setMinFilter(Texture.MinFilter.Trilinear);
    offTex.setMagFilter(Texture.MagFilter.Bilinear);
 
    //setup framebuffer to use texture
    offBuffer.setDepthBuffer(Format.Depth);
    offBuffer.setMultiTarget(true);
    offBuffer.addColorTexture(offTex, TextureCubeMap.Face.NegativeX);
    offBuffer.addColorTexture(offTex, TextureCubeMap.Face.PositiveX);
    offBuffer.addColorTexture(offTex, TextureCubeMap.Face.NegativeY);
    offBuffer.addColorTexture(offTex, TextureCubeMap.Face.PositiveY);
    offBuffer.addColorTexture(offTex, TextureCubeMap.Face.NegativeZ);
    offBuffer.addColorTexture(offTex, TextureCubeMap.Face.PositiveZ);
    
    //set viewport to render to offscreen framebuffer
    offView.setOutputFrameBuffer(offBuffer);
 
    // setup framebuffer's scene
    Box boxMesh = new Box( 1,1,1);
    Material material = assetManager.loadMaterial("Interface/Logo/Logo.j3m");
    offBox = new Geometry("box", boxMesh);
    offBox.setMaterial(material);
 
    // attach the scene to the viewport to be rendered
    offView.attachScene(offBox);
 
    return offTex;
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:45,代码来源:TestRenderToCubemap.java


示例6: createSky

import com.jme3.texture.TextureCubeMap; //导入依赖的package包/类
public static Spatial createSky(AssetManager assetManager, Texture west, Texture east, Texture north, Texture south, Texture up, Texture down, Vector3f normalScale, int sphereRadius) {
    final Sphere sphereMesh = new Sphere(10, 10, sphereRadius, false, true);
    Geometry sky = new Geometry("Sky", sphereMesh);
    sky.setQueueBucket(Bucket.Sky);
    sky.setCullHint(Spatial.CullHint.Never);
    sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));

    Image westImg = west.getImage();
    Image eastImg = east.getImage();
    Image northImg = north.getImage();
    Image southImg = south.getImage();
    Image upImg = up.getImage();
    Image downImg = down.getImage();

    checkImagesForCubeMap(westImg, eastImg, northImg, southImg, upImg, downImg);

    Image cubeImage = new Image(westImg.getFormat(), westImg.getWidth(), westImg.getHeight(), null);

    cubeImage.addData(westImg.getData(0));
    cubeImage.addData(eastImg.getData(0));

    cubeImage.addData(downImg.getData(0));
    cubeImage.addData(upImg.getData(0));

    cubeImage.addData(southImg.getData(0));
    cubeImage.addData(northImg.getData(0));
    
    if (westImg.getEfficentData() != null){
        // also consilidate efficient data
        ArrayList<Object> efficientData = new ArrayList<Object>(6);
        efficientData.add(westImg.getEfficentData());
        efficientData.add(eastImg.getEfficentData());
        efficientData.add(downImg.getEfficentData());
        efficientData.add(upImg.getEfficentData());
        efficientData.add(southImg.getEfficentData());
        efficientData.add(northImg.getEfficentData());
        cubeImage.setEfficentData(efficientData);
    }

    TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
    cubeMap.setAnisotropicFilter(0);
    cubeMap.setMagFilter(Texture.MagFilter.Bilinear);
    cubeMap.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
    cubeMap.setWrap(Texture.WrapMode.EdgeClamp);

    Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    skyMat.setTexture("Texture", cubeMap);
    skyMat.setVector3("NormalScale", normalScale);
    sky.setMaterial(skyMat);

    return sky;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:53,代码来源:SkyFactory.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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