// -------------------------------------------------------------- // Define animation sequences for moving parts // -------------------------------------------------------------- void HST::DefineAnimations (void) { // 1. Hi-gain antenna static UINT HiGainAnt1Grp[2] = {1,3}; static MGROUP_ROTATE HiGainAnt1 (0, HiGainAnt1Grp, 2, _V(0.002579,1.993670,0.238158), _V(-1,0,0), (float)(PI*0.51)); static UINT HiGainAnt2Grp[2] = {0,2}; static MGROUP_ROTATE HiGainAnt2 (0, HiGainAnt2Grp, 2, _V(0.002740,-2.013091,0.238118), _V(1,0,0), (float)(PI*0.51)); anim_ant = CreateAnimation (0.0196); AddAnimationComponent (anim_ant, 0, 0.5, &HiGainAnt1); AddAnimationComponent (anim_ant, 0, 1, &HiGainAnt2); // 2. Main telescope hatch static UINT HatchGrp[1] = {86}; static MGROUP_ROTATE Hatch (0, HatchGrp, 1, _V(0.089688,1.456229,7.526453), _V(-1,0,0), (float)(RAD*113)); anim_hatch = CreateAnimation (0); AddAnimationComponent (anim_hatch, 0, 1, &Hatch); // 3. Solar arrays - folding anim_array = CreateAnimation (1); static UINT ArrayLFoldGrp[5] = {87,88,89,90,103}; static UINT ArrayRFoldGrp[5] = {92,93,94,95,102}; static MGROUP_ROTATE ArrayLFold1 (0, ArrayLFoldGrp, 5, _V(-1.9, 0.053583,1.429349), _V(0,-1,0), (float)(PI*0.5)); AddAnimationComponent (anim_array, 0, 0.4, &ArrayLFold1); static MGROUP_ROTATE ArrayLFold2 (0, ArrayLFoldGrp, 5, _V(0,0.053583,1.429349), _V(-1,0,0), (float)(PI*0.5)); AddAnimationComponent (anim_array, 0.4, 0.6, &ArrayLFold2); static MGROUP_SCALE ArrayLFold3 (0, ArrayLFoldGrp, 4, _V(0,0.053583,1.429349), _V(1,1,4)); AddAnimationComponent (anim_array, 0.6, 1, &ArrayLFold3); static MGROUP_ROTATE ArrayRFold1 (0, ArrayRFoldGrp, 5, _V( 1.9, 0.053583,1.429349), _V(0, 1,0), (float)(PI*0.5)); AddAnimationComponent (anim_array, 0, 0.4, &ArrayRFold1); static MGROUP_ROTATE ArrayRFold2 (0, ArrayRFoldGrp, 5, _V(0,0.053583,1.429349), _V(-1,0,0), (float)(PI*0.5)); AddAnimationComponent (anim_array, 0.4, 0.6, &ArrayRFold2); static MGROUP_SCALE ArrayRFold3 (0, ArrayRFoldGrp, 4, _V(0,0.053583,1.429349), _V(1,1,4)); AddAnimationComponent (anim_array, 0.6, 1, &ArrayRFold3); }
AnimationPtr ModelActorFactory::BuildAnimation( Model& model, Actor& rootActor, size_t index, AlphaFunction alpha, float durationSeconds) { AnimationPtr animation; Internal::ModelDataPtr modelData(model.GetModelData()); if (modelData) { if (index >= modelData->NumberOfAnimationMaps()) { DALI_LOG_ERROR("Invalid animation index\n"); } else { const ModelAnimationMap* animationData(modelData->GetAnimationMap(index)); if( animationData != NULL ) { animation = CreateAnimation(rootActor, animationData, alpha, durationSeconds); } } } return animation; }
bool BattleEntity::init() { m_vecAnimation.resize(ES_MAX); m_vecAnimation[ES_IDLE] = "Idle"; m_vecAnimation[ES_IDLE2] = "Idle"; m_vecAnimation[ES_RUN] = "Move"; m_vecAnimation[ES_WIN] = "Cheer"; m_vecAnimation[ES_FALIURE] = "failure"; m_vecAnimation[ES_ATTACK1] = "atk"; m_vecAnimation[ES_ATTACK2] = "atk"; m_vecAnimation[ES_SKILL1] = "atk2"; m_vecAnimation[ES_SKILL2] = "atk2"; m_vecAnimation[ES_HURT] = "Damaged"; m_vecAnimation[ES_DEAD] = "Death"; InitData(); m_pAnimationNode = CreateAnimation(); addChild(m_pAnimationNode); m_pAnimationNode->setPosition(getAnchorPointInPoints()); OnAnimationCreate(m_pAnimationNode); scheduleUpdate(); return true; }
// -------------------------------------------------------------- // Define animation sequences for moving parts // -------------------------------------------------------------- void SolarSail::DefineAnimations () { int i; // Steering paddle animations static UINT PaddleGrp[4] = {GRP_paddle1, GRP_paddle2, GRP_paddle3, GRP_paddle4}; static MGROUP_ROTATE Paddle0 (0, PaddleGrp+0, 1, _V(0,0,0), _V(0,1,0), (float)(180.0*RAD)); static MGROUP_ROTATE Paddle1 (0, PaddleGrp+1, 1, _V(0,0,0), _V(1,0,0), (float)(180.0*RAD)); static MGROUP_ROTATE Paddle2 (0, PaddleGrp+2, 1, _V(0,0,0), _V(0,1,0), (float)(180.0*RAD)); static MGROUP_ROTATE Paddle3 (0, PaddleGrp+3, 1, _V(0,0,0), _V(1,0,0), (float)(180.0*RAD)); static MGROUP_ROTATE *Paddle[4] = {&Paddle0, &Paddle1, &Paddle2, &Paddle3}; for (i = 0; i < 4; i++) { anim_paddle[i] = CreateAnimation(0.5); AddAnimationComponent (anim_paddle[i], 0, 1, Paddle[i]); } }
Object CreateObject(Vector2 pos, float r, ALLEGRO_BITMAP* obj_bitmap, ALLEGRO_BITMAP* exp_bitmap) { Object object; object.pos = pos; object.vel = CreateVector2(0, 0); object.acc = CreateVector2(0, 0); object.r = r; object.d = 2 * r; object.first_update = true; // inicjalizujemy obiekt eksplozji (parametry na podstawie pliku graficznego): object.explosion = CreateExplosion(CreateAnimation(object.pos, 38, 1, CreateSize(128, 128), CreateSize(object.d * 4, object.d * 4), exp_bitmap)); object.entrance_animation.active = false; object.bitmap = obj_bitmap; return object; }
clAnimation* clResourcesManager::LoadAnimation( const LString& FileName ) { double StartTime = Env->GetSeconds(); clAnimation* Resource = FindResourceFile<clAnimation>( FileName ); if ( !Resource ) { bool CacheEnabled = Env->Console->GetVarDefault( "Cache.AnimationsCacheEnabled", "false" )->GetBool(); Resource = CreateAnimation(); Resource->Load( FileName, CacheEnabled ); } FTime_Animations += Env->GetSeconds() - StartTime; return Resource; }
void Graphics_Mesh(bool isOpenGLMode) { StartGraphicsTest(); SetGLEnable(isOpenGLMode); asd::Log* log = asd::Log_Imp::Create(L"graphics.html", L"メッシュ"); auto window = asd::Window_Imp::Create(640, 480, asd::ToAString(L"メッシュ").c_str()); ASSERT_TRUE(window != nullptr); auto file = asd::File_Imp::Create(); ASSERT_TRUE(file != nullptr); auto graphics = asd::Graphics_Imp::Create(window, isOpenGLMode ? asd::GraphicsDeviceType::OpenGL : asd::GraphicsDeviceType::DirectX11, log, file, false, false); ASSERT_TRUE(graphics != nullptr); auto renderer3d = new asd::Renderer3D(graphics, asd::RenderSettings()); ASSERT_TRUE(renderer3d != nullptr); renderer3d->SetWindowSize(asd::Vector2DI(640, 480)); auto mesh1 = CreateMesh(graphics); auto mesh2 = CreateMesh(graphics); auto deformer = CreateDeformer(graphics); auto animation = CreateAnimation(); SetMeshBone(mesh2); mesh1->SendToGPUMemory(); mesh2->SendToGPUMemory(); auto cameraObject = new asd::RenderedCameraObject3D(graphics); cameraObject->SetPosition(asd::Vector3DF(0, 0, 10)); cameraObject->SetFocus(asd::Vector3DF(0, 0, 0)); cameraObject->SetFieldOfView(20.0f); cameraObject->SetZNear(1.0f); cameraObject->SetZFar(20.0f); cameraObject->SetWindowSize(asd::Vector2DI(800, 600)); auto meshObject1 = new asd::RenderedModelObject3D(graphics); meshObject1->AddMesh(mesh1); meshObject1->SetPosition(asd::Vector3DF(1, 0, 0)); meshObject1->SetRotation(asd::Vector3DF(20.0f, 20.0f, 0.0f)); auto meshObject2 = new asd::RenderedModelObject3D(graphics); meshObject2->AddMesh(mesh2); meshObject2->SetDeformer(deformer.get()); meshObject2->SetPosition(asd::Vector3DF(-1, 0, 0)); meshObject2->SetRotation(asd::Vector3DF(20.0f, 20.0f, 0.0f)); meshObject2->AddAnimationClip(asd::ToAString("anime1").c_str(), animation.get()); meshObject2->PlayAnimation(0, asd::ToAString("anime1").c_str()); auto lightObject = new asd::RenderedDirectionalLightObject3D(graphics); lightObject->SetRotation(asd::Vector3DF(30, 160, 0)); renderer3d->AddObject(cameraObject); renderer3d->AddObject(meshObject1); renderer3d->AddObject(meshObject2); renderer3d->AddObject(lightObject); int32_t time = 0; while (window->DoEvent()) { graphics->Begin(); graphics->Clear(true, false, asd::Color(0, 0, 0, 255)); renderer3d->Flip(1); renderer3d->BeginRendering(1); asd::Sleep(100); renderer3d->EndRendering(); graphics->SetRenderTarget(nullptr, nullptr); graphics->Clear(true, false, asd::Color(0, 0, 0, 255)); renderer3d->RenderResult(); graphics->Present(); graphics->End(); if (time == 10) { SAVE_SCREEN_SHOT(graphics, 0); } if (time == 11) { window->Close(); } time++; } meshObject1->Release(); meshObject2->Release(); cameraObject->Release(); lightObject->Release(); delete renderer3d; graphics->Release(); file->Release(); window->Release(); delete log; }
// -------------------------------------------------------------- // Set the capabilities of the vessel class // -------------------------------------------------------------- void ShuttlePB::clbkSetClassCaps (FILEHANDLE cfg) { THRUSTER_HANDLE th_main, th_hover, th_rcs[14], th_group[4]; // physical vessel parameters SetSize (PB_SIZE); SetEmptyMass (PB_EMPTYMASS); SetPMI (PB_PMI); SetCrossSections (PB_CS); SetRotDrag (PB_RD); SetTouchdownPoints (PB_TDP[0], PB_TDP[1], PB_TDP[2]); // docking port definitions SetDockParams (PB_DOCK_POS, PB_DOCK_DIR, PB_DOCK_ROT); // airfoil definitions CreateAirfoil3 (LIFT_VERTICAL, PB_COP, vlift, NULL, PB_VLIFT_C, PB_VLIFT_S, PB_VLIFT_A); CreateAirfoil3 (LIFT_HORIZONTAL, PB_COP, hlift, NULL, PB_HLIFT_C, PB_HLIFT_S, PB_HLIFT_A); // control surface animations UINT anim_Laileron = CreateAnimation (0.5); UINT anim_Raileron = CreateAnimation (0.5); UINT anim_elevator = CreateAnimation (0.5); AddAnimationComponent (anim_Laileron, 0, 1, &trans_Laileron); AddAnimationComponent (anim_Raileron, 0, 1, &trans_Raileron); AddAnimationComponent (anim_elevator, 0, 1, &trans_Lelevator); AddAnimationComponent (anim_elevator, 0, 1, &trans_Relevator); // aerodynamic control surface defintions CreateControlSurface (AIRCTRL_ELEVATOR, 1.5, 0.7, _V( 0,0,-2.5), AIRCTRL_AXIS_XPOS, anim_elevator); CreateControlSurface (AIRCTRL_AILERON, 1.5, 0.25, _V( 1,0,-2.5), AIRCTRL_AXIS_XPOS, anim_Laileron); CreateControlSurface (AIRCTRL_AILERON, 1.5, 0.25, _V(-1,0,-2.5), AIRCTRL_AXIS_XNEG, anim_Raileron); // propellant resources PROPELLANT_HANDLE hpr = CreatePropellantResource (PB_FUELMASS); // main engine th_main = CreateThruster (_V(0,0,-4.35), _V(0,0,1), PB_MAXMAINTH, hpr, PB_ISP); CreateThrusterGroup (&th_main, 1, THGROUP_MAIN); AddExhaust (th_main, 8, 1, _V(0,0.3,-4.35), _V(0,0,-1)); PARTICLESTREAMSPEC contrail_main = { 0, 5.0, 16, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE, PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2, PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1 }; PARTICLESTREAMSPEC exhaust_main = { 0, 2.0, 20, 200, 0.05, 0.1, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE, PARTICLESTREAMSPEC::LVL_SQRT, 0, 1, PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1 }; AddExhaustStream (th_main, _V(0,0.3,-10), &contrail_main); AddExhaustStream (th_main, _V(0,0.3,-5), &exhaust_main); // hover engine th_hover = CreateThruster (_V(0,-1.5,0), _V(0,1,0), PB_MAXHOVERTH, hpr, PB_ISP); CreateThrusterGroup (&th_hover, 1, THGROUP_HOVER); AddExhaust (th_hover, 8, 1, _V(0,-1.5,1), _V(0,-1,0)); AddExhaust (th_hover, 8, 1, _V(0,-1.5,-1), _V(0,-1,0)); PARTICLESTREAMSPEC contrail_hover = { 0, 5.0, 8, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE, PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2, PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1 }; PARTICLESTREAMSPEC exhaust_hover = { 0, 2.0, 10, 200, 0.05, 0.05, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE, PARTICLESTREAMSPEC::LVL_SQRT, 0, 1, PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1 }; AddExhaustStream (th_hover, _V(0,-3, 1), &contrail_hover); AddExhaustStream (th_hover, _V(0,-3,-1), &contrail_hover); AddExhaustStream (th_hover, _V(0,-2, 1), &exhaust_hover); AddExhaustStream (th_hover, _V(0,-2,-1), &exhaust_hover); // RCS engines th_rcs[ 0] = CreateThruster (_V( 1,0, 3), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 1] = CreateThruster (_V( 1,0, 3), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 2] = CreateThruster (_V(-1,0, 3), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 3] = CreateThruster (_V(-1,0, 3), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 4] = CreateThruster (_V( 1,0,-3), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 5] = CreateThruster (_V( 1,0,-3), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 6] = CreateThruster (_V(-1,0,-3), _V(0, 1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 7] = CreateThruster (_V(-1,0,-3), _V(0,-1,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 8] = CreateThruster (_V( 1,0, 3), _V(-1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[ 9] = CreateThruster (_V(-1,0, 3), _V( 1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[10] = CreateThruster (_V( 1,0,-3), _V(-1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[11] = CreateThruster (_V(-1,0,-3), _V( 1,0,0), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[12] = CreateThruster (_V( 0,0,-3), _V(0,0, 1), PB_MAXRCSTH, hpr, PB_ISP); th_rcs[13] = CreateThruster (_V( 0,0, 3), _V(0,0,-1), PB_MAXRCSTH, hpr, PB_ISP); th_group[0] = th_rcs[0]; th_group[1] = th_rcs[2]; th_group[2] = th_rcs[5]; th_group[3] = th_rcs[7]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHUP); th_group[0] = th_rcs[1]; th_group[1] = th_rcs[3]; th_group[2] = th_rcs[4]; th_group[3] = th_rcs[6]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_PITCHDOWN); th_group[0] = th_rcs[0]; th_group[1] = th_rcs[4]; th_group[2] = th_rcs[3]; th_group[3] = th_rcs[7]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_BANKLEFT); th_group[0] = th_rcs[1]; th_group[1] = th_rcs[5]; th_group[2] = th_rcs[2]; th_group[3] = th_rcs[6]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_BANKRIGHT); th_group[0] = th_rcs[0]; th_group[1] = th_rcs[4]; th_group[2] = th_rcs[2]; th_group[3] = th_rcs[6]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_UP); th_group[0] = th_rcs[1]; th_group[1] = th_rcs[5]; th_group[2] = th_rcs[3]; th_group[3] = th_rcs[7]; CreateThrusterGroup (th_group, 4, THGROUP_ATT_DOWN); th_group[0] = th_rcs[8]; th_group[1] = th_rcs[11]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWLEFT); th_group[0] = th_rcs[9]; th_group[1] = th_rcs[10]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWRIGHT); th_group[0] = th_rcs[8]; th_group[1] = th_rcs[10]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_LEFT); th_group[0] = th_rcs[9]; th_group[1] = th_rcs[11]; CreateThrusterGroup (th_group, 2, THGROUP_ATT_RIGHT); CreateThrusterGroup (th_rcs+12, 1, THGROUP_ATT_FORWARD); CreateThrusterGroup (th_rcs+13, 1, THGROUP_ATT_BACK); // camera parameters SetCameraOffset (_V(0,0.8,0)); // associate a mesh for the visual AddMesh ("ShuttlePB"); }
uint cAnimationManager::LoadAnimation(std::string _filename){ std::string fullFile = (char*)STORM_DIR_ANIMS + _filename; cBinaryFile tmpFile; tmpFile.Open(fullFile); if(!tmpFile.IsOpen()){ StormPrintLog(STORM_LOG_ERROR, "cAnimation", "Could not open file %s for loading", fullFile.c_str()); return 0; } int tmpInt = 0; int tmpFps = 0; bool isUseTextures = true; //Beginning of file float tmpFloat = tmpFile.ReadFloat(); if(tmpFloat != 16.20f){ StormPrintLog(STORM_LOG_ERROR, "cAnimation", "Invalid file format %s %f", fullFile.c_str(), tmpFloat); tmpFile.Close(); return 0; } //File version if(tmpFile.ReadInt() != (int)STORM_ANIM_FILEVER){ StormPrintLog(STORM_LOG_ERROR, "cAnimation", "Invalid file version %s", fullFile.c_str()); tmpFile.Close(); return 0; } //FPS tmpFps = tmpFile.ReadInt(); //Frames count tmpInt = tmpFile.ReadInt(); //Is texture made from texture sections, or multiple textures if(tmpFile.ReadByte() == '1'){ //Animations is made from multiple textures isUseTextures = true; }else{ //Animations is made form texture sections isUseTextures = false; } //Load frames std::vector<uint> tmpFrames; //Used if animations is created from texture sections std::vector<sTextureSection> tmpSections; for(int i = 0; i < tmpInt; i++){ if(!isUseTextures){ //Animation is made from texture sections sTextureSection tmpS; tmpS.x = tmpFile.ReadInt(); tmpS.y = tmpFile.ReadInt(); tmpS.width = tmpFile.ReadInt(); tmpS.height = tmpFile.ReadInt(); tmpSections.push_back(tmpS); }else{ //Animations is made from multiple textures std::string txFilename = tmpFile.ReadString(); uint tmpFrame = tManager->LoadTexture(txFilename); if(tmpFrame == 0){ StormPrintLog(STORM_LOG_ERROR, "cAnimation", "Frame %s is missing. Animation can not be loaded", txFilename.c_str()); tmpFile.Close(); return 0; } tmpFrames.push_back(tmpFrame); } } if(!isUseTextures){ //Animations is made from texture sections //Load texture here std::string txFilename = tmpFile.ReadString(); uint tmpTexture = tManager->LoadTexture(txFilename); if(tmpTexture == 0){ StormPrintLog(STORM_LOG_ERROR, "cAnimation", "Texture %s is missing. Animation can not be loaded", txFilename.c_str()); tmpFile.Close(); tmpSections.clear(); return 0; } for(int i = 0; i < (int)tmpSections.size(); i++){ tmpSections[i].texture = tmpTexture; tmpFrames.push_back(tManager->CreateSection(tmpSections[i])); } } //Create new animation uint animId = CreateAnimation(tmpFrames, tmpFps, isUseTextures); cAnimation *tmpAnim = GetAnimation(animId); //Read frame groups int grCount = tmpFile.ReadInt(); if(grCount > 0){ for (int i = 0; i < grCount; i++) { std::string tmpStr = tmpFile.ReadString(); int tmpSt = tmpFile.ReadInt(); int tmpEn = tmpFile.ReadInt(); tmpAnim->AddFrameGroup(tmpStr, tmpSt, tmpEn); } } tmpFile.Close(); tmpAnim->SetFilename(_filename); tmpAnim->SetIsLoadedFromFile(true); StormPrintLog(STORM_LOG_INFO, "cAnimation", "Animation %s loaded", _filename.c_str()); return animId; }
void VisualInit(Visual& visual, Type type, sf::FloatRect & rect, std::vector<json_spirit::Pair> & int_rects) { visual.animation = CreateAnimation(type, int_rects); visual.rect = new sf::Rect<float>; *visual.rect = rect; }
void Graphics_Mesh(bool isOpenGLMode) { StartGraphicsTest(); SetGLEnable(isOpenGLMode); ace::Log* log = ace::Log_Imp::Create(L"graphics.html", L"メッシュ"); auto window = ace::Window_Imp::Create(640, 480, ace::ToAString(L"メッシュ").c_str()); ASSERT_TRUE(window != nullptr); auto graphics = ace::Graphics_Imp::Create(window, isOpenGLMode, log, false); ASSERT_TRUE(graphics != nullptr); auto renderer3d = new ace::Renderer3D(graphics); ASSERT_TRUE(renderer3d != nullptr); renderer3d->SetWindowSize(ace::Vector2DI(640, 480)); auto mesh1 = CreateMesh(graphics); auto mesh2 = CreateMesh(graphics); auto deformer = CreateDeformer(graphics); auto animation = CreateAnimation(); auto cameraObject = new ace::RenderedCameraObject3D(graphics); cameraObject->SetPosition(ace::Vector3DF(0, 0, 10)); cameraObject->SetFocus(ace::Vector3DF(0, 0, 0)); cameraObject->SetFieldOfView(20.0f); cameraObject->SetZNear(1.0f); cameraObject->SetZFar(20.0f); cameraObject->SetWindowSize(ace::Vector2DI(800, 600)); auto meshObject1 = new ace::RenderedModelObject3D(graphics); meshObject1->AddMeshGroup(); meshObject1->AddMesh(0, mesh1); meshObject1->SetPosition(ace::Vector3DF(1, 0, 0)); meshObject1->SetRotation(ace::Vector3DF(20.0f, 20.0f, 0.0f)); auto meshObject2 = new ace::RenderedModelObject3D(graphics); meshObject2->AddMeshGroup(); meshObject2->AddMesh(0, mesh2); meshObject2->SetDeformer(0, deformer.get()); meshObject2->SetPosition(ace::Vector3DF(-1, 0, 0)); meshObject2->SetRotation(ace::Vector3DF(20.0f, 20.0f, 0.0f)); meshObject2->AddAnimationClip(ace::ToAString("anime1").c_str(), animation.get()); meshObject2->PlayAnimation(ace::ToAString("anime1").c_str()); auto lightObject = new ace::RenderedDirectionalLightObject3D(graphics); lightObject->SetRotation(ace::Vector3DF(30, 160, 0)); renderer3d->AddObject(cameraObject); renderer3d->AddObject(meshObject1); renderer3d->AddObject(meshObject2); renderer3d->AddObject(lightObject); auto renderer2d = new ace::Renderer2D_Imp(graphics, log, window->GetSize()); int32_t time = 0; while (window->DoEvent()) { graphics->Begin(); graphics->Clear(true, false, ace::Color(0, 0, 0, 255)); renderer3d->Flip(); renderer3d->BeginRendering(); ace::Sleep(100); renderer3d->EndRendering(); graphics->SetRenderTarget(nullptr, nullptr); ace::Vector2DF positions[4]; ace::Color colors[4]; ace::Vector2DF uvs[4]; colors[0] = ace::Color(255, 255, 255, 255); colors[1] = ace::Color(255, 255, 255, 255); colors[2] = ace::Color(255, 255, 255, 255); colors[3] = ace::Color(255, 255, 255, 255); positions[0].X = 0; positions[0].Y = 0; positions[1].X = 640; positions[1].Y = 0; positions[2].X = 640; positions[2].Y = 480; positions[3].X = 0; positions[3].Y = 480; uvs[0].X = 0; uvs[0].Y = 0; uvs[1].X = 1; uvs[1].Y = 0; uvs[2].X = 1; uvs[2].Y = 1; uvs[3].X = 0; uvs[3].Y = 1; renderer2d->AddSprite(positions, colors, uvs, renderer3d->GetRenderTarget(), ace::eAlphaBlend::ALPHA_BLEND_BLEND, 0); renderer2d->DrawCache(); renderer2d->ClearCache(); graphics->Present(); graphics->End(); if (time == 10) { SAVE_SCREEN_SHOT(graphics, 0); } if (time == 11) { window->Close(); } time++; } meshObject1->Release(); meshObject2->Release(); cameraObject->Release(); lightObject->Release(); delete renderer2d; delete renderer3d; graphics->Release(); window->Release(); delete log; }
hdAnimation* hdAnimationController::CreateAnimation(const void *parent) { return CreateAnimation(parent, true); }