Examples of ConstraintHelper


Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

    }
   
    @Override
    public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
        if (needToCompute && influence != 0) {
            ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
            BoneContext[] boneContexts = this.getBones();
            float b = chainLength;
            Quaternion boneWorldRotation = new Quaternion();

            for (int i = 0; i < boneContexts.length; ++i) {
                Bone bone = boneContexts[i].getBone();

                bone.updateWorldVectors();
                Transform boneWorldTransform = constraintHelper.getTransform(boneContexts[i].getArmatureObjectOMA(), bone.getName(), Space.CONSTRAINT_SPACE_WORLD);

                Vector3f head = boneWorldTransform.getTranslation();
                Vector3f tail = head.add(bone.getModelSpaceRotation().mult(Vector3f.UNIT_Y.mult(boneContexts[i].getLength())));

                Vector3f vectorA = tail.subtract(head);
                float a = vectorA.length();
                vectorA.normalizeLocal();

                Vector3f vectorC = targetTransform.getTranslation().subtract(head);
                float c = vectorC.length();
                vectorC.normalizeLocal();

                b -= a;
                float theta = 0;

                if (c >= a + b) {
                    theta = vectorA.angleBetween(vectorC);
                } else if (c <= FastMath.abs(a - b) && i < boneContexts.length - 1) {
                    theta = vectorA.angleBetween(vectorC) - FastMath.HALF_PI;
                } else {
                    theta = vectorA.angleBetween(vectorC) - FastMath.acos(-(b * b - a * a - c * c) / (2 * a * c));
                }
               
                theta *= influence;

                if (theta != 0) {
                    Vector3f vectorR = vectorA.cross(vectorC);
                    boneWorldRotation.fromAngleAxis(theta, vectorR);
                    boneWorldTransform.getRotation().multLocal(boneWorldRotation);
                    constraintHelper.applyTransform(boneContexts[i].getArmatureObjectOMA(), bone.getName(), Space.CONSTRAINT_SPACE_WORLD, boneWorldTransform);
                }

                bone.updateWorldVectors();
                alteredOmas.add(boneContexts[i].getBoneOma());
            }
View Full Code Here

Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

    @Override
    public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
        Object target = this.getTarget();// Bone or Node
        Object owner = this.getOwner();// Bone or Node
        if (!target.getClass().equals(owner.getClass())) {
            ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);

            TempVars tempVars = TempVars.get();
            Matrix4f m = constraintHelper.toMatrix(targetTransform, tempVars.tempMat4);
            tempVars.tempMat42.set(BoneContext.BONE_ARMATURE_TRANSFORMATION_MATRIX);
            if (target instanceof Bone) {
                tempVars.tempMat42.invertLocal();
            }
            m = m.multLocal(tempVars.tempMat42);
View Full Code Here

Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

                    }
                }
            }

            // bake constraints after everything is loaded
            ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
            constraintHelper.bakeConstraints(blenderContext);

            // attach the nodes to the root node at the very end so that the root objects have no parents during constraint applying
            LOGGER.fine("Creating the root node of the model and applying loaded nodes of the scene to it.");
            Node modelRoot = new Node(blenderKey.getName());
            for (Node node : rootObjects) {
View Full Code Here

Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

            LOGGER.fine("Applying animations to the object if such are defined.");
            AnimationHelper animationHelper = blenderContext.getHelper(AnimationHelper.class);
            animationHelper.applyAnimations(result, blenderContext.getBlenderKey().getNodeAnimationNames(name));

            LOGGER.fine("Loading constraints connected with this object.");
            ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
            constraintHelper.loadConstraints(objectStructure, blenderContext);

            LOGGER.fine("Loading custom properties.");
            if (blenderContext.getBlenderKey().isLoadObjectProperties()) {
                Properties properties = this.loadProperties(objectStructure, blenderContext);
                // the loaded property is a group property, so we need to get
View Full Code Here

Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

                        break;
                }
            }

            // bake constraints after everything is loaded
            ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
            constraintHelper.bakeConstraints(blenderContext);

            // load the scene at the very end so that the root nodes have no parent during loading or constraints applying
            for (FileBlockHeader sceneBlock : sceneBlocks) {
                loadingResults.addScene(this.toScene(sceneBlock.getStructure(blenderContext)));
            }
View Full Code Here

Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

        blenderContext.putHelper(CurvesHelper.class, new CurvesHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(LightHelper.class, new LightHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(CameraHelper.class, new CameraHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(ModifierHelper.class, new ModifierHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(MaterialHelper.class, new MaterialHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(ConstraintHelper.class, new ConstraintHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(ParticlesHelper.class, new ParticlesHelper(inputStream.getVersionNumber(), blenderContext));
        blenderContext.putHelper(LandscapeHelper.class, new LandscapeHelper(inputStream.getVersionNumber(), blenderContext));
       
        // reading the blocks (dna block is automatically saved in the blender context when found)
        FileBlockHeader sceneFileBlock = null;
View Full Code Here

Examples of com.jme3.scene.plugins.blender.constraints.ConstraintHelper

            // then make sure it is rotated in a proper way to fit the jme bone transformation conventions
            globalBoneMatrix.multLocal(BONE_ARMATURE_TRANSFORMATION_MATRIX);
        }

        Spatial armature = (Spatial) objectHelper.toObject(blenderContext.getFileBlock(armatureObjectOMA).getStructure(blenderContext), blenderContext);
        ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
        Matrix4f armatureWorldMatrix = constraintHelper.toMatrix(armature.getWorldTransform(), new Matrix4f());

        // and now compute the final bone matrix in world space
        globalBoneMatrix = armatureWorldMatrix.mult(globalBoneMatrix);

        // create the children
View Full Code Here

Examples of org.hibernate.validation.metadata.ConstraintHelper

  public ValidatorFactoryImpl(ConfigurationState configurationState) {
    this.messageInterpolator = configurationState.getMessageInterpolator();
    this.constraintValidatorFactory = configurationState.getConstraintValidatorFactory();
    this.traversableResolver = configurationState.getTraversableResolver();
    this.constraintHelper = new ConstraintHelper();
    this.beanMetaDataCache = new BeanMetaDataCache();

    initBeanMetaData( configurationState.getMappingStreams() );
  }
View Full Code Here

Examples of org.hibernate.validator.ap.util.ConstraintHelper

    AnnotationApiHelper annotationApiHelper = new AnnotationApiHelper(
        processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils()
    );

    ConstraintHelper constraintHelper = new ConstraintHelper(
        processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils(), annotationApiHelper
    );

    constraintCheckFactory = new ConstraintCheckFactory(
        processingEnvironment.getTypeUtils(),
View Full Code Here

Examples of org.hibernate.validator.ap.util.ConstraintHelper

    AnnotationApiHelper annotationApiHelper = new AnnotationApiHelper(
        processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils()
    );

    ConstraintHelper constraintHelper = new ConstraintHelper(
        processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils(), annotationApiHelper
    );

    constraintCheckFactory = new ConstraintCheckFactory(
        processingEnvironment.getTypeUtils(), constraintHelper, annotationApiHelper
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.