Exemple #1
0
bool BL_ShapeDeformer::Update(void)
{
	bool bShapeUpdate = false;
	bool bSkinUpdate = false;

	ExecuteShapeDrivers();

	/* See if the object shape has changed */
	if (m_lastShapeUpdate != m_gameobj->GetLastFrame()) {
		/* the key coefficient have been set already, we just need to blend the keys */
		Object* blendobj = m_gameobj->GetBlendObject();
		
		// make sure the vertex weight cache is in line with this object
		m_pMeshObject->CheckWeightCache(blendobj);

		/* we will blend the key directly in m_transverts array: it is used by armature as the start position */
		/* m_bmesh->key can be NULL in case of Modifier deformer */
		if (m_bmesh->key) {
			/* store verts locally */
			VerifyStorage();

			do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, NULL, 0); /* last arg is ignored */
			m_bDynamic = true;
		}

		// Don't release the weight array as in Blender, it will most likely be reusable on next frame 
		// The weight array are ultimately deleted when the skin mesh is destroyed
		   
		/* Update the current frame */
		m_lastShapeUpdate=m_gameobj->GetLastFrame();

		// As we have changed, the mesh, the skin deformer must update as well.
		// This will force the update
		BL_SkinDeformer::ForceUpdate();
		bShapeUpdate = true;
	}
	// check for armature deform
	bSkinUpdate = BL_SkinDeformer::UpdateInternal(bShapeUpdate && m_bDynamic);

	// non dynamic deformer = Modifer without armature and shape keys, no need to create storage
	if (!bSkinUpdate && bShapeUpdate && m_bDynamic) {
		// this means that there is no armature, we still need to 
		// update the normal (was not done after shape key calculation)

#ifdef __NLA_DEFNORMALS
		if (m_recalcNormal)
			RecalcNormals();
#endif
		bSkinUpdate = true;
	}
	return bSkinUpdate;
}
Exemple #2
0
//void where_is_pose (Object *ob);
//void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag);
bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
{
    /* See if the armature has been updated for this frame */
    if (PoseUpdated()) {
        float obmat[4][4];	// the original object matrice

        /* XXX note: where_is_pose() (from BKE_armature.h) calculates all matrices needed to start deforming */
        /* but it requires the blender object pointer... */
        Object* par_arma = m_armobj->GetArmatureObject();

        if(!shape_applied) {
            /* store verts locally */
            VerifyStorage();

            /* duplicate */
            for (int v =0; v<m_bmesh->totvert; v++)
                VECCOPY(m_transverts[v], m_bmesh->mvert[v].co);
        }

        m_armobj->ApplyPose();

        // save matrix first
        Mat4CpyMat4(obmat, m_objMesh->obmat);
        // set reference matrix
        Mat4CpyMat4(m_objMesh->obmat, m_obmat);

        armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL, NULL );

        // restore matrix
        Mat4CpyMat4(m_objMesh->obmat, obmat);

#ifdef __NLA_DEFNORMALS
        if (m_recalcNormal)
            RecalcNormals();
#endif

        /* Update the current frame */
        m_lastArmaUpdate=m_armobj->GetLastFrame();

        m_armobj->RestorePose();
        /* dynamic vertex, cannot use display list */
        m_bDynamic = true;
        /* indicate that the m_transverts and normals are up to date */
        return true;
    }

    return false;
}
bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
{
	/* See if the armature has been updated for this frame */
	if (PoseUpdated()) {	

		if (!shape_applied) {
			/* store verts locally */
			VerifyStorage();
		
			/* duplicate */
			for (int v =0; v<m_bmesh->totvert; v++)
			{
				copy_v3_v3(m_transverts[v], m_bmesh->mvert[v].co);
				normal_short_to_float_v3(m_transnors[v], m_bmesh->mvert[v].no);
			}
		}

		m_armobj->ApplyPose();

		switch (m_armobj->GetVertDeformType())
		{
			case ARM_VDEF_BGE_CPU:
				BGEDeformVerts();
				break;
			case ARM_VDEF_BLENDER:
			default:
				BlenderDeformVerts();
		}

		/* Update the current frame */
		m_lastArmaUpdate=m_armobj->GetLastFrame();

		m_armobj->RestorePose();
		/* dynamic vertex, cannot use display list */
		m_bDynamic = true;
		/* indicate that the m_transverts and normals are up to date */
		return true;
	}

	return false;
}
Exemple #4
0
HRESULT CPkcs7::HashAndSetStorage(IStorage* pstg, HCRYPTPROV hprov, ALG_ID algidHash)
// Set the content to be the indicated raw file, using the indicated hash algorithm
	{
	PKCS7_FILEDATA rf;
	m_pworld->Init(rf);
	rf.link.tag = CERT_LINK_TYPE_NONE;
	HRESULT hr = HashStorage(m_pworld, pstg, hprov, algidHash, rf.digest);
	if (hr == S_OK)
		{
		hr = put_ContentStructuredStorage(&rf);
		}

	#ifdef _DEBUG
	if (hr == S_OK)
		{
		GOOD(VerifyStorage(pstg, hprov, algidHash));
		}
	#endif

	return hr;
	}