当前位置: 首页>>代码示例>>Java>>正文


Java ShadowMode类代码示例

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


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

示例1: write

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public void write(JmeExporter ex) throws IOException {
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(name, "name", null);
    capsule.write(worldBound, "world_bound", null);
    capsule.write(cullHint, "cull_mode", CullHint.Inherit);
    capsule.write(batchHint, "batch_hint", BatchHint.Inherit);
    capsule.write(queueBucket, "queue", RenderQueue.Bucket.Inherit);
    capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit);
    capsule.write(localTransform, "transform", Transform.IDENTITY);
    capsule.write(localLights, "lights", null);
    capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null);

    // Shallow clone the controls array to convert its type.
    capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null);
    capsule.writeStringSavableMap(userData, "user_data", null);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:Spatial.java

示例2: makeCannonBall

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
/** This method creates one individual physical cannon ball.
 * By defaul, the ball is accelerated and flies
 * from the camera position in the camera direction.*/
 public void makeCannonBall() {
  /** Create a cannon ball geometry and attach to scene graph. */
  Geometry ball_geo = new Geometry("cannon ball", sphere);
  ball_geo.setMaterial(stone_mat);
  rootNode.attachChild(ball_geo);
  /** Position the cannon ball and activate shadows */
  ball_geo.setLocalTranslation(cam.getLocation());
  ball_geo.setShadowMode(ShadowMode.CastAndReceive);
  /** Make the ball physcial with a mass > 0.0f */
  ball_phy = new RigidBodyControl(1f);
  /** Add physical ball to physics space. */
  ball_geo.addControl(ball_phy);
  bulletAppState.getPhysicsSpace().add(ball_phy);
  /** Accelerate the physcial ball to shoot it. */
  ball_phy.setLinearVelocity(cam.getDirection().mult(25));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:HelloPhysics.java

示例3: buildPlayer

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
private void buildPlayer() {
    spaceCraft = assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml");
    CollisionShape colShape = CollisionShapeFactory.createDynamicMeshShape(spaceCraft);
    spaceCraft.setShadowMode(ShadowMode.CastAndReceive);
    spaceCraft.setLocalTranslation(new Vector3f(-140, 14, -23));
    spaceCraft.setLocalRotation(new Quaternion(new float[]{0, 0.01f, 0}));

    hoverControl = new PhysicsHoverControl(colShape, 500);
    hoverControl.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);

    spaceCraft.addControl(hoverControl);


    rootNode.attachChild(spaceCraft);
    getPhysicsSpace().add(hoverControl);

    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    spaceCraft.addControl(chaseCam);

    flyCam.setEnabled(false);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:TestHoveringTank.java

示例4: onAction

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public void onAction(String name, boolean keyPressed, float tpf) {
            if (name.equals("shoot") && !keyPressed) {
                Geometry bulletg = new Geometry("bullet", bullet);
                bulletg.setMaterial(mat2);
                bulletg.setShadowMode(ShadowMode.CastAndReceive);
                bulletg.setLocalTranslation(cam.getLocation());
                
                SphereCollisionShape bulletCollisionShape = new SphereCollisionShape(0.4f);
                RigidBodyControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1);
//                RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, 1);
                bulletNode.setLinearVelocity(cam.getDirection().mult(25));
                bulletg.addControl(bulletNode);
                rootNode.attachChild(bulletg);
                getPhysicsSpace().add(bulletNode);
            }
            if (name.equals("gc") && !keyPressed) {
                System.gc();
            }
        }
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:TestBrickWall.java

示例5: renderShadow

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
/**
 * If a spatial is not inside the eye frustum, it
 * is still rendered in the shadow frustum (shadow casting queue)
 * through this recursive method.
 */
private void renderShadow(Spatial s, RenderQueue rq) {
    if (s instanceof Node) {
        Node n = (Node) s;
        List<Spatial> children = n.getChildren();
        for (int i = 0; i < children.size(); i++) {
            renderShadow(children.get(i), rq);
        }
    } else if (s instanceof Geometry) {
        Geometry gm = (Geometry) s;

        RenderQueue.ShadowMode shadowMode = s.getShadowMode();
        if (shadowMode != RenderQueue.ShadowMode.Off && shadowMode != RenderQueue.ShadowMode.Receive) {
            //forcing adding to shadow cast mode, culled objects doesn't have to be in the receiver queue
            rq.addToShadowQueue(gm, RenderQueue.ShadowMode.Cast);
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:RenderManager.java

示例6: read

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);

    name = ic.readString("name", null);
    worldBound = (BoundingVolume) ic.readSavable("world_bound", null);
    cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit);
    queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class,
            RenderQueue.Bucket.Inherit);
    shadowMode = ic.readEnum("shadow_mode", ShadowMode.class,
            ShadowMode.Inherit);

    localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY);

    localLights = (LightList) ic.readSavable("lights", null);
    localLights.setOwner(this);

    //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
    //the AnimControl creates the SkeletonControl for old files and add it to the spatial.
    //The SkeletonControl must be the last in the stack so we add the list of all other control before it.
    //When backward compatibility won't be needed anymore this can be replaced by : 
    //controls = ic.readSavableArrayList("controlsList", null));
    controls.addAll(0, ic.readSavableArrayList("controlsList", null));

    userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:Spatial.java

示例7: postFrame

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public void postFrame(FrameBuffer out) {
    Camera cam = viewPort.getCamera();
    if (!noOccluders) {
        postshadowMat.setColor("Splits", splits);
        for (int i = 0; i < nbSplits; i++) {
            postshadowMat.setMatrix4("LightViewProjectionMatrix" + i, lightViewProjectionsMatrices[i]);
        }
        renderManager.setForcedMaterial(postshadowMat);
        viewPort.getQueue().renderShadowQueue(ShadowMode.Receive, renderManager, cam, true);
        renderManager.setForcedMaterial(null);
        renderManager.setCamera(cam, false);

    }
    if (debug) {
        displayShadowMap(renderManager.getRenderer());
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:PssmShadowRenderer.java

示例8: onEntityUpdated

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
@Override
protected void onEntityUpdated(Entity e) {
	if (SpatialPool.models.containsKey(e.getId())) {
		RendererPlatform.getMainSceneNode().detachChild(SpatialPool.models.get(e.getId()));
	}

	Model model = e.get(Model.class);

	Spatial s = getPrototype(model.path);

	if (s != null) {
		s = s.clone();
		Naming n = entityData.getComponent(e.getId(), Naming.class);
		if (n != null) {
			s.setName(n.getName());
		} else {
			s.setName("unnamed entity #" + e.getId());
		}
		s.scale((float) model.scale);
		s.setUserData("EntityId", e.getId().getId());
		s.setShadowMode(ShadowMode.CastAndReceive);
		SpatialPool.models.put(e.getId(), s);
		RendererPlatform.getMainSceneNode().attachChild(s);
	}
}
 
开发者ID:meltzow,项目名称:supernovae,代码行数:26,代码来源:ModelLoadingProc.java

示例9: createFrustum

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public static Geometry createFrustum(Camera cam, AssetManager assetManager){
	Vector3f[] pts = new Vector3f[8];
	for(int i = 0; i < pts.length; i++) pts[i] = new Vector3f();
	ShadowUtil.updateFrustumPoints2(cam, pts);
	WireFrustum frustum = new WireFrustum(pts);
	Geometry frustumMdl = new Geometry("_frustum."+cam.getName(), frustum);
	frustumMdl.setCullHint(Spatial.CullHint.Never);
	frustumMdl.setShadowMode(ShadowMode.Off);
	frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
	frustumMdl.getMaterial().setColor("Color", ColorRGBA.Brown);
	frustumMdl.addControl(new AbstractControl() {
		@Override
		protected void controlUpdate(float tpf) {
			ShadowUtil.updateFrustumPoints2(cam, pts);
			frustum.update(pts);
		}

		@Override
		protected void controlRender(RenderManager rm, ViewPort vp) {
		}
	});
	return frustumMdl;
}
 
开发者ID:davidB,项目名称:jme3_ext_spatial_explorer,代码行数:24,代码来源:Helper.java

示例10: FootStep

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public FootStep(Material material, String type, Vector3f location, Vector3f direction) {
    this.type = type;
    this.location = location;
    this.direction = direction;

    Vector3f nDirection = direction.normalize();

    Vector3f rotAxis = direction.cross(normalDirAxis);
    float angle = FastMath.acos(rotAxis.dot(nDirection));

    Quaternion q = new Quaternion();
    q.fromAngleAxis(angle, rotAxis);

    this.setLocalRotation(q);
    this.setLocalTranslation(location);

    Box step = new Box(0.5f, 0.01f, 0.5f);
    Geometry jg = new Geometry(name + "_joint", step);
    jg.setShadowMode(ShadowMode.Off);
    jg.setMaterial(material);

    this.attachChild(jg);
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:24,代码来源:FootStep.java

示例11: createPrefab

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public static Spatial createPrefab(NamedNodeMap map, AssetManager manager) throws InstantiationException, IllegalAccessException, ClassNotFoundException {

        String meshFile = getAttrContent("mesh", map);
        if (meshFile == null || meshFile.length() == 0) {
            return null;
        }
        String name = getAttrContent("name", map);
        String shadowMode = getAttrContent("shadowmode", map);
        try {
            Spatial result = manager.loadModel(meshFile);
            result.setName(name);
            result.setShadowMode(ShadowMode.valueOf(shadowMode));
            return result;
        } catch (AssetNotFoundException ex) {
            return null;
        }
    }
 
开发者ID:samynk,项目名称:DArtE,代码行数:18,代码来源:GameSceneLoader.java

示例12: createKlatch

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public static Node createKlatch(NamedNodeMap map, AssetManager manager) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
    String klatchFile = getAttrContent("klatch", map);
    if (klatchFile == null || klatchFile.length() == 0) {
        return null;
    }
    AssetInfo info = manager.locateAsset(new AssetKey(klatchFile));
    Node klatch = new Node();
    GameSceneLoader.loadScene(info.openStream(), manager, klatch);

    String name = getAttrContent("name", map);
    String shadowMode = getAttrContent("shadowmode", map);

    try {
        klatch.setName(name);
        RenderQueue.ShadowMode sm = RenderQueue.ShadowMode.valueOf(shadowMode);
        klatch.setShadowMode(sm);
    } catch (IllegalArgumentException ex) {
    }
    return klatch;
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:21,代码来源:GameSceneLoader.java

示例13: SelectMarker

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public SelectMarker(ColorEnum color) {
	
	geometry = new Geometry("selectCross", mesh);
	geometry.setQueueBucket(Bucket.Translucent);  
	geometry.setShadowMode(ShadowMode.Off);
	switch (color) {
	case BLUE:
		geometry.setMaterial(blueMaterial);
		break;
	case RED:
		geometry.setMaterial(redMaterial);
		break;
	case GREEN:
		geometry.setMaterial(greenMaterial);
		break;
	default:
		geometry.setMaterial(redMaterial);
		break;
	}
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:21,代码来源:SelectMarker.java

示例14: TitleScreenSprite

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public TitleScreenSprite(Type type, String image, float x, float y, float sizeX, float sizeY, TitleScreenSprite label, Node labelNode) {
	this.x = x;
	this.y = y;
	this.type = type;
	this.sizeX = sizeX;
	this.sizeY = sizeY;
	this.label = label;
	this.labelNode = labelNode;
	
	AssetManager assetManager = HexScapeCore.getInstance().getHexScapeJme3Application().getAssetManager();
	
	Material configMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
	Texture configTex = assetManager.loadTexture(image);
	configMat.setTexture("ColorMap", configTex);
	configMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
	Quad quad = new Quad(sizeX, sizeY, false);
	setMesh(quad);
	setMaterial(configMat);
	setQueueBucket(Bucket.Translucent);  
	setShadowMode(ShadowMode.Off);
	setLocalRotation(ROTATION);
	setLocalTranslation(-x + sizeX/2, 1, y - sizeY/2);
}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:24,代码来源:TitleScreenSprite.java

示例15: postFrame

import com.jme3.renderer.queue.RenderQueue.ShadowMode; //导入依赖的package包/类
public void postFrame(FrameBuffer out) {
    Camera cam = viewPort.getCamera();
    if (!noOccluders) {
        postshadowMat.setColor("Splits", splits);
        for (int i = 0; i < nbSplits; i++) {
            postshadowMat.setMatrix4("LightViewProjectionMatrix" + i, lightViewProjectionsMatrices[i]);
        }
        renderManager.setForcedMaterial(postshadowMat);

        viewPort.getQueue().renderShadowQueue(ShadowMode.Receive, renderManager, cam, flushQueues);

        renderManager.setForcedMaterial(null);
        renderManager.setCamera(cam, false);

    }
    if (debug) {
        displayShadowMap(renderManager.getRenderer());
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:20,代码来源:PssmShadowRenderer.java


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