void set_scene (OBJScene* in) { ISPCScene* out = new ISPCScene; out->meshes = new ISPCMesh*[in->meshes.size()]; for (size_t i=0; i<in->meshes.size(); i++) out->meshes[i] = convertMesh(in->meshes[i]); out->numMeshes = in->meshes.size(); out->materials = (ISPCMaterial*) (in->materials.size() ? &in->materials[0] : NULL); out->numMaterials = in->materials.size(); out->hairs = new ISPCHairSet*[in->hairsets.size()]; for (size_t i=0; i<in->hairsets.size(); i++) out->hairs[i] = convertHair(in->hairsets[i]); out->numHairSets = in->hairsets.size(); out->ambientLights = (ISPCAmbientLight*) (in->ambientLights.size() ? &in->ambientLights[0] : NULL); out->numAmbientLights = in->ambientLights.size(); out->pointLights = (ISPCPointLight*) (in->pointLights.size() ? &in->pointLights[0] : NULL); out->numPointLights = in->pointLights.size(); out->dirLights = (ISPCDirectionalLight*) (in->directionalLights.size() ? &in->directionalLights[0] : NULL); out->numDirectionalLights = in->directionalLights.size(); out->distantLights = (ISPCDistantLight*) (in->distantLights.size() ? &in->distantLights[0] : NULL); out->numDistantLights = in->distantLights.size(); out->subdiv = new ISPCSubdivMesh*[in->subdiv.size()]; for (size_t i=0; i<in->subdiv.size(); i++) out->subdiv[i] = convertSubdivMesh(in->subdiv[i]); out->numSubdivMeshes = in->subdiv.size(); g_ispc_scene = out; }
void gkAnimationLoader::convertObject(gkGameObject* obj, Blender::Object* bobj, bool pre25compat, gkScalar animfps) { // 2.4x if(pre25compat) { if(bobj && bobj->ipo) { gkAnimation* act = dynamic_cast<gkAnimation*>(gkAnimationManager::getSingleton().getByName(gkResourceName(GKB_IDNAME(bobj->ipo), m_groupName))); if(!act) act = convertObjectIpoToAnimation(bobj->ipo, animfps); if(act) obj->addAnimation(act, GKB_IDNAME(bobj->ipo)); } if(bobj && bobj->action) { gkResourceName name(GKB_IDNAME(bobj->action), m_groupName); gkAnimation* act = dynamic_cast<gkAnimation*>(gkAnimationManager::getSingleton().getByName(name)); if(!act) { convertAction(bobj->action, pre25compat, animfps); act = dynamic_cast<gkAnimation*>(gkAnimationManager::getSingleton().getByName(name)); } if(act) obj->addAnimation(act, GKB_IDNAME(bobj->action)); } // TODO 2.4 NLA } // 2.5x else if (bobj->adt) { convert25AnimData(obj, bobj->adt, animfps); } // object data switch (bobj->type) { case OB_LAMP: convertLamp(obj, bobj, pre25compat, animfps); break; case OB_CAMERA: convertCamera(obj, bobj, pre25compat, animfps); break; case OB_MESH: convertMesh(obj, bobj, pre25compat, animfps); break; case OB_ARMATURE: convertArmature(obj, bobj, pre25compat, animfps); break; } }
bool CWall::create(IDirect3DDevice9* pDevice, float iwidth, float iheight, float idepth, Type type){ m_width = iwidth; m_depth = idepth; m_height = iheight; if (FAILED(D3DXCreateBox(pDevice, iwidth, iheight, idepth, &m_pMesh, 0))) return false; LPD3DXMESH newMesh = convertMesh(pDevice, m_pMesh); if (newMesh == nullptr){ m_pMesh->Release(); return false; } switch (type){ case Plane: textureFile = PLANE_TEXTURE; effectFile = PLANE_EFFECT; break; case Edge: effectFile = EDGE_EFFECT; textureFile = EDGE_TEXTURE; break; } m_texture = LoadTexture(pDevice, textureFile); m_effect = LoadShader(pDevice, effectFile); if (m_texture == nullptr || m_effect == nullptr) return false; m_pMesh->Release(); m_pMesh = newMesh; return true; }