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

Java SkeletonControl类代码示例

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

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



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

示例1: createFor

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
@FXThread
public <T, V extends TreeNode<T>> @Nullable V createFor(@Nullable final T element, final long objectId) {

    if (element instanceof MotionEvent) {
        return unsafeCast(new MotionEventTreeNode((MotionEvent) element, objectId));
    } else if (element instanceof KinematicRagdollControl) {
        return unsafeCast(new RagdollControlTreeNode((KinematicRagdollControl) element, objectId));
    } else if (element instanceof VehicleControl) {
        return unsafeCast(new VehicleControlTreeNode((VehicleControl) element, objectId));
    } else if (element instanceof SkeletonControl) {
        return unsafeCast(new SkeletonControlTreeNode((SkeletonControl) element, objectId));
    } else if (element instanceof CharacterControl) {
        return unsafeCast(new CharacterControlTreeNode((CharacterControl) element, objectId));
    } else if (element instanceof RigidBodyControl) {
        return unsafeCast(new RigidBodyControlTreeNode((RigidBodyControl) element, objectId));
    }  else if (element instanceof LightControl) {
        return unsafeCast(new LightControlTreeNode((LightControl) element, objectId));
    } else if (element instanceof Control) {
        return unsafeCast(new ControlTreeNode<>((Control) element, objectId));
    }

    return null;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:25,代码来源:ControlTreeNodeFactory.java


示例2: createSheet

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("SkeletonControl");
    set.setName(SkeletonControl.class.getName());
    if (skeletonControl == null) {
        return sheet;
    }
    Property<?> prop = makeProperty(skeletonControl, boolean.class, "isHardwareSkinningPreferred", "setHardwareSkinningPreferred", "Hardware Skinning");
    prop.setShortDescription("This Preference enables/disables the usage of HW Skinning for this Skeleton. This will improve your performance and is the default, however you might want to turn it off to debug some failure. Also Note that setting it to true doesn't guarantee that HW Skinning is used, it has to be supported by the Platform.");
    set.put(prop);
    
    //  set.put(new AnimationProperty(animControl));

    sheet.put(set);
    return sheet;

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:21,代码来源:JmeSkeletonControl.java


示例3: doLink

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
	public boolean doLink(RelationsMerger loader, RefData data, Logger log) {
		Material op1=getRef1(data,Material.class,log);
		Geometry op2=getRef2(data,Geometry.class,log);
		if(op1==null||op2==null) return false;
		if(op2.getControl(SkeletonControl.class)!=null){
			op1=op1.clone();
//			data.context.put("G~"+data.ref1+"~cloned~"+System.currentTimeMillis(),op1,data.ref1);
//		}else{
//			String refusage="G~usage~"+data.ref1;
//			int n=(int)Optional.ofNullable(data.context.get(refusage)).orElse(0);
//			data.context.put(refusage,n++);
		}
		op2.setMaterial(op1);
		return true;
	}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:17,代码来源:MaterialToGeometry.java


示例4: showSkeleton

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
public void showSkeleton(Node n) {
    Skeleton sk = null;
    SkeletonControl sc = n.getControl(SkeletonControl.class);
    if (sc != null) {
        sk = sc.getSkeleton();
    }
    AnimControl control = n.getControl(AnimControl.class);
    if (sk == null && control != null) {
        sk = control.getSkeleton();
    }
    if (sk != null) {
        final SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton." + n.getName(), sk);
        final Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Green);
        mat.getAdditionalRenderState().setWireframe(true);
        mat.getAdditionalRenderState().setDepthTest(false);
        skeletonDebug.setMaterial(mat);
        n.attachChild(skeletonDebug);
    }
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:21,代码来源:TestJaimeJ3o.java


示例5: showSkeleton

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
public void showSkeleton(Node n) {
	Skeleton sk = null;
	SkeletonControl sc = n.getControl(SkeletonControl.class);
	if (sc != null) {
		sk = sc.getSkeleton();
	}
	AnimControl control = n.getControl(AnimControl.class);
	if (sk == null && control != null) {
		sk = control.getSkeleton();
	}
	if (sk != null) {
		final SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton." + n.getName(), sk);
		final Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
		mat.setColor("Color", ColorRGBA.Green);
		mat.getAdditionalRenderState().setWireframe(true);
		mat.getAdditionalRenderState().setDepthTest(false);
		skeletonDebug.setMaterial(mat);
		n.attachChild(skeletonDebug);
	}
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:21,代码来源:TestXbufWithMaterialHook.java


示例6: buildNode

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
public void buildNode() {
	node = new Node();
	node.attachChild(meshGeom);

	// create and attach controls
	control = new AnimControl(skeleton);
	node.addControl(control);
	// adding the control to the geom has no effect
	// ogre mesh loader adds it to the node as well

	// additional skeleton control inspired by ogre mesh loader
	skeletonControl = new SkeletonControl(skeleton);
	node.addControl(skeletonControl);
	// trying to add the skeletonControl to the geom gives an exception

	node.scale(0.1f); // TODO this is a random default?
	node.rotate(FastMath.PI, 0, 0);
	node.updateModelBound();
}
 
开发者ID:morris,项目名称:vstools-java,代码行数:20,代码来源:WEP.java


示例7: buildForImpl

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
@FXThread
protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent,
                            @NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer) {

    if (object instanceof AbstractCinematicEvent) {
        build((AbstractCinematicEvent) object, container, changeConsumer);
    }  else if (object instanceof VehicleWheel) {
        build((VehicleWheel) object, container, changeConsumer);
    } else if (object instanceof Animation) {
        build((Animation) object, container, changeConsumer);
    }

    if (!(object instanceof Control)) return;

    if (object instanceof AbstractControl) {
        build((AbstractControl) object, container, changeConsumer);
    }

    super.buildForImpl(object, parent, container, changeConsumer);

    if (object instanceof SkeletonControl) {
        build((SkeletonControl) object, container, changeConsumer);
    } else if (object instanceof CharacterControl) {
        build((CharacterControl) object, container, changeConsumer);
    } else if (object instanceof RigidBodyControl) {
        build((RigidBodyControl) object, container, changeConsumer);
    } else if (object instanceof VehicleControl) {
        build((VehicleControl) object, container, changeConsumer);
    } else if (object instanceof MotionEvent) {
        build((MotionEvent) object, container, changeConsumer);
    }

    if (object instanceof PhysicsRigidBody) {
        build((PhysicsRigidBody) object, container, changeConsumer);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:38,代码来源:DefaultControlPropertyBuilder.java


示例8: build

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@FXThread
private void build(@NotNull final SkeletonControl control, @NotNull final VBox container,
                   @NotNull final ModelChangeConsumer changeConsumer) {

    final boolean hardwareSkinningPreferred = control.isHardwareSkinningPreferred();

    final BooleanPropertyControl<ModelChangeConsumer, SkeletonControl> hardwareSkinningPreferredControl =
            new BooleanPropertyControl<>(hardwareSkinningPreferred, Messages.MODEL_PROPERTY_IS_HARDWARE_SKINNING_PREFERRED, changeConsumer);

    hardwareSkinningPreferredControl.setApplyHandler(SkeletonControl::setHardwareSkinningPreferred);
    hardwareSkinningPreferredControl.setSyncHandler(SkeletonControl::isHardwareSkinningPreferred);
    hardwareSkinningPreferredControl.setEditObject(control);

    FXUtils.addToPane(hardwareSkinningPreferredControl, container);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:16,代码来源:DefaultControlPropertyBuilder.java


示例9: simpleInitApp

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    flyCam.setMoveSpeed(10f);
    cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));
    cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));

    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
    dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
    rootNode.addLight(dl);

    Spatial model = (Spatial) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
    model.center();

    control = model.getControl(AnimControl.class);
    control.addListener(this);
    channel = control.createChannel();

    for (String anim : control.getAnimationNames())
        System.out.println(anim);

    channel.setAnim("stand");

    SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);

    Box b = new Box(.25f,3f,.25f);
    Geometry item = new Geometry("Item", b);
    item.move(0, 1.5f, 0);
    item.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
    Node n = skeletonControl.getAttachmentsNode("hand.right");
    n.attachChild(item);

    rootNode.attachChild(model);

    inputManager.addListener(this, "Attack");
    inputManager.addMapping("Attack", new KeyTrigger(KeyInput.KEY_SPACE));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:38,代码来源:TestOgreAnim.java


示例10: initialize

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);

//        cachedMap = new HashMap<>();
        cachedControls = Collections.newSetFromMap(new ConcurrentHashMap<SkeletonControl, Boolean>());
    }
 
开发者ID:NemesisMate,项目名称:UtilJME3-Debug,代码行数:8,代码来源:DebugSkeletonState.java


示例11: removeAnimData

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
public static void removeAnimData(Spatial root) {
    root.depthFirstTraversal(new SceneGraphVisitor() {
        @Override
        public void visit(Spatial spat) {
            AnimControl animControl = spat.getControl(AnimControl.class);
            if (animControl != null) {
                spat.removeControl(animControl);
                SkeletonControl skeletonControl = spat.getControl(SkeletonControl.class);
                if (skeletonControl != null) {
                    spat.removeControl(skeletonControl);
                }
            }
        }
    });
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:16,代码来源:SpatialUtil.java


示例12: JmeSkeletonControl

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
public JmeSkeletonControl(SkeletonControl skeletonControl, JmeBoneChildren children) {
    super(children);
    this.skeletonControl = skeletonControl;
    control = skeletonControl;
    lookupContents.add(this);
    lookupContents.add(skeletonControl);
    setName("SkeletonControl");
    children.setSkeltonControl(this);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:10,代码来源:JmeSkeletonControl.java


示例13: trySwitchToHardware

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
/**
 * 打开skin的hws,如果角色actor主SkeletonControl已经打开该功能,则该方法将偿试打开skinNode的hws以配合角色骨骼.
 * @param actor
 * @param skinNode 
 */
public static void trySwitchToHardware(Entity actor, Spatial skinNode) {
    // 如果hsw未打开,则不需要管,交由sc内部去一起处理就可以.
    SkeletonControl sc = actor.getSpatial().getControl(SkeletonControl.class);
    if (!sc.isHardwareSkinningUsed()) {
        return;
    }
    
    // 如果hsw已经开启过了,则需要把skinNode处理后再添加到actor中,否则skinNode将无法启用hsw
    final Set<Mesh> targets = new HashSet<Mesh>();
    final Set<Material> materials = new HashSet<Material>();
    Node tempNode = new Node();
    tempNode.attachChild(skinNode);
    findTargets(tempNode, targets, materials);
    
    // Next full 10 bones (e.g. 30 on 24 bones)
    Skeleton skeleton = sc.getSkeleton();
    int numBones = ((skeleton.getBoneCount() / 10) + 1) * 10;
    for (Material m : materials) {
        m.setInt("NumberOfBones", numBones);
    }
    for (Mesh mesh : targets) {
        if (mesh.isAnimated()) {
            mesh.prepareForAnim(false);
        }
    }
    sc.setSpatial(actor.getSpatial());
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:33,代码来源:GeometryUtils.java


示例14: onInitScene

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
public void onInitScene(Scene scene) {
    super.onInitScene(scene);
    
    //  Trace设置需要放在effectInstance初始化之前
    if (traceEntity >= 0) {
        Entity target = scene.getEntity(traceEntity);
        if (target != null) {
            Spatial targetSpatial = target.getSpatial();
            Spatial targetBoneSpatial = null;
            if (traceBone != null) {
                SkeletonControl sc = targetSpatial.getControl(SkeletonControl.class);
                if (sc != null) {
                    Bone bone = sc.getSkeleton().getBone(traceBone);
                    if (bone != null) {
                        targetBoneSpatial = sc.getAttachmentsNode(traceBone);
                    }
                }
            }
            Spatial traceSpatial = targetBoneSpatial != null ? targetBoneSpatial : targetSpatial;
            effectInstance.setLocalTranslation(traceSpatial.getWorldTranslation());
            effectInstance.setLocalRotation(traceSpatial.getWorldRotation());
            if (effectInstance instanceof TraceEffect) {
                ((TraceEffect) effectInstance).setTraceObject(traceSpatial);
            }
        }
    }
    
    if (!effectInstance.isInitialized()) {
        effectInstance.initialize();
    }
    // 在特效结束时,同时将EffectEntity移除出场景
    effectInstance.addListener(effectListener);

}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:36,代码来源:EffectEntity.java


示例15: checkEnableHardwareSkining

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
/**
 * 检测并判断是否打开或关闭该模型的硬件skining加速
 */
private static void checkEnableHardwareSkining(Spatial actorModel) {
    SkeletonControl sc = actorModel.getControl(SkeletonControl.class);
    if (sc == null) {
        return;
    }
    // 代换自定义的SkeletonControl,因为默认的SkeletonControl会把带
    // SkeletonControl的子节点也进行处理。比如弓武器,当弓武器带有动画时可能
    // 导致角色的SkeletonControl和弓的SkeletonControl存在冲突导致弓模型变形
    CustomSkeletonControl csc = new CustomSkeletonControl(sc.getSkeleton());
    actorModel.removeControl(sc);
    actorModel.addControl(csc);
    csc.setHardwareSkinningPreferred(true);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:17,代码来源:Actor.java


示例16: takeArrow

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
private void takeArrow() {
    SkeletonControl sc = actor.getSpatial().getControl(SkeletonControl.class);
    if (sc != null && arrowNode != null) {
        Bone abb = sc.getSkeleton().getBone(arrowBindBone);
        if (abb != null) {
            Node abbNode = sc.getAttachmentsNode(arrowBindBone);
            abbNode.attachChild(arrowNode);
        }
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:11,代码来源:ShotBowSkill.java


示例17: simpleInitApp

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
    public void simpleInitApp() {
//		assetManager.registerLocator("assets/", FileLocator.class);

        // 关闭第一人称
//		flyCam.setEnabled(false);
        this.getFlyByCamera().setMoveSpeed(30);
        cam.setFrustumPerspective(45, (float) cam.getWidth() / cam.getHeight(), 0.1F, 1000);
        AmbientLight amb = new AmbientLight();
        amb.setColor(new ColorRGBA(0.6F, 0.8F, 0.8F, 1.0f));
        rootNode.addLight(amb);

        DirectionalLight light = new DirectionalLight();
        light.setColor(new ColorRGBA(1.0f, 0.9f, 0.8f, 1.0f));
        light.setDirection(new Vector3f(0F, -0.779F, 0.627F));
        rootNode.addLight(light);

        // 第一步加载骨骼文件
        ske = (Node) assetManager.loadModel("Models/actor/ske.mesh.j3o");
        SkeletonControl sc = ske.getControl(SkeletonControl.class);
        
        CustomSkeletonControl csc = new CustomSkeletonControl(sc.getSkeleton());
        ske.removeControl(sc);
        ske.addControl(csc);
//        csc.setHardwareSkinningPreferred(true);
        

        rootNode.attachChild(ske);
        addSkeletonAnim(assetManager.loadModel("Models/actor/ext_anim/idle_run.mesh.j3o"), ske);
        // 加载初始化皮肤
        ske.attachChild(assetManager.loadModel("Models/actor/female/foot.003.mesh.j3o"));

        // 播放动画
        AnimControl animControl = ske.getControl(AnimControl.class);
        System.out.println(animControl.getAnimationNames().toString());
        anim = animControl.createChannel();
        anim.setAnim("idle_run");

        keyMapping();
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:41,代码来源:RoleTest.java


示例18: doLink

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
public boolean doLink(RelationsMerger loader, RefData data, Logger log) {
	Object op1=getRef1(data,Geometry.class,log);
	Object op2=getRef2(data,Skeleton.class,log);

	if(op1==null||op2==null){
		op2=getRef1(data,Skeleton.class,log);
		op1=getRef2(data,Node.class,log);
	}

	if(op1==null||op2==null) return false;
	Spatial v=(Spatial)op1;
	Skeleton sk=(Skeleton)op2;

	// TODO: update skel w/o remove
	v.removeControl(SkeletonControl.class);

	SkeletonControl skc=new SkeletonControl(sk);
	v.addControl(skc);

	boolean atLeastOne=false;
	for(int i=0;i<v.getNumControls();i++){
		Control c=v.getControl(i);
		if( c instanceof AnimControl) {
			atLeastOne=true;
			((AnimControl)c).setSkeleton(sk);
		}
	}

	// always add AnimControl else NPE when SkeletonControl.clone
	if(!atLeastOne)v.addControl(new AnimControl(sk));

	cloneMatWhenNeeded((Spatial)op1,data,log);
	return true;
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:36,代码来源:SkeletonToSpatial.java


示例19: doLink

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
@Override
public boolean doLink(RelationsMerger loader,RefData data, Logger log) {
	XbufAnimation op1=getRef1(data,XbufAnimation.class,log);
	Spatial op2=getRef2(data,Spatial.class,log);
	if(op1==null||op2==null)return false;
	AnimControl c=op2.getControl(AnimControl.class);
	if(c==null){
		SkeletonControl sc=op2.getControl(SkeletonControl.class);
		c=sc!=null?new AnimControl(sc.getSkeleton()):new AnimControl();
		op2.addControl(c);
	}
	c.addAnim(op1.toJME(c.getSkeleton()));
	return true;
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:15,代码来源:AnimationToSpatial.java


示例20: SkeletonControlTreeNode

import com.jme3.animation.SkeletonControl; //导入依赖的package包/类
public SkeletonControlTreeNode(@NotNull final SkeletonControl element, final long objectId) {
    super(element, objectId);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:4,代码来源:SkeletonControlTreeNode.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java PackageFragment类代码示例发布时间:2022-05-22
下一篇:
Java StepMetaInjectionInterface类代码示例发布时间: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