void test_image_manager::test1(void) { _START(); _INFO("Verify of internal class nnImageManager: method read configuration and load images"); _AUTHOR("Coppi Angelo n2draw library "); _STOP(); miniXmlNode node; #ifdef _UNICODE bool res = miniXmlNode::load(X("..\\..\\conf_utf16.xml"),&node); #else bool res = miniXmlNode::load(X("..\\..\\conf_utf8.xml"),&node); #endif CA_ASSERT(res == true); STRING s; nnImageManager im(s); res = im.readConfiguration(&node); CA_ASSERT(res == true); res = im.loadImages(); CA_ASSERT(res == true); /* const listImage *images = im.getImageList(); if (images != nullptr) { listImage::const_iterator it = images->begin(); listImage::const_iterator _end = images->end(); while (it != _end) { draw((it->second)); it++; } } */ }
bool AABB::ContainsBox(AABB const& b) const { CA_ASSERT( min.IsValid(), "ContainsBox() : min is not valid"); CA_ASSERT( max.IsValid(), "ContainsBox() : max is not valid"); CA_ASSERT( b.min.IsValid(), "ContainsBox() : b.min is not valid"); CA_ASSERT( b.max.IsValid(), "ContainsBox() : b.max is not valid"); return min.x <= b.min.x && min.y <= b.min.y && min.z <= b.min.z && max.x >= b.max.x && max.y >= b.max.y && max.z >= b.max.z; }
void test_bmpImage_class::test2(void) { _START(); _INFO("verifica interna alla classe: metodo create"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; CA_ASSERT(s.create(100, 100,24, 255) == true); CA_ASSERT((LPBITMAPFILEHEADER)s != nullptr); }
void test_bmpImage_class::test13(void) { _START(); _INFO("verifica interrna alla classe:dimensioni"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(50, 100,24, 255); CA_ASSERT(s.check(50, 100)==true); CA_ASSERT(s.check(150, 100)==false); }
void test_bmpImage_class::test9(void) { _START(); _INFO("verifica interrna alla classe:metodo detach"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s; CA_ASSERT(s.detach()==true); CA_ASSERT((LPBITMAPFILEHEADER)(s)==nullptr); delete [](v); }
void test_bmpImage_class::test3(void) { _START(); _INFO("verifica interrna alla classe : verifica struttura bitmapfileheader"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s; CA_ASSERT(v->bfType == 0x4d42); CA_ASSERT(v->bfOffBits == ((int)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)))); CA_ASSERT(v->bfSize == ((int)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (100 * 100 * 3)))); }
void test_app_manager::test1(void) { _START(); _INFO("Verify of internal class nnAppManager:load and display a draw"); _AUTHOR("Coppi Angelo n2draw library "); _STOP(); nnAppManager app; #ifdef _UNICODE STRING name(X("conf_utf16.xml")); #else STRING name(X("conf_utf8.xml")); #endif STRING path("./"); IChild *childs = app.createObjects(name,path); CA_ASSERT(childs != nullptr); bool res; nnPoint p=childs->getView()->getConstPhy(); CA_ASSERT(p.x != 0 ); CA_ASSERT(p.y != 0); res=childs->getImage()->loadImages(); CA_ASSERT(res == true); nnContactNO *v = new nnContactNO(); nnObjManager *mn = dynamic_cast<nnObjManager *>(childs->getManager()); res = mn->addContact(10, 0, v); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)1); nnGenericCoil *u = new nnGenericCoil(); res = mn->addCoil(10, u); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)20); nnContactNC *v1 = new nnContactNC(); res = mn->addContact(12, 0, v1); CA_ASSERT(res == true); nnPoint p1(12, 0); nnPoint p2(10, 0); nnConnection::connectComponent(childs->getManager(), p1, p2); res = childs->getView()->updateDraw(); CA_ASSERT(res == true); bmpImage &bdraw = childs->getView()->getDraw(); for(unsigned int i=0;i<bdraw.getWidth();i+=100) bdraw.line(i,0,i,bdraw.getHeight(),255,0,0,0xfefefefe); for(unsigned int u=0;u<bdraw.getHeight();u+=100) bdraw.line(0,u,bdraw.getWidth(),u,0,0,255,0xfefefefe); bdraw.line(0,0,bdraw.getWidth(),bdraw.getHeight(),0,255,0,0xfefefefe); bdraw.line(0,0,200,bdraw.getHeight(),0,255,255,0xfefefefe); bdraw.frameRect(10,10,300,300,128,128,64,0xfefefefe); bdraw.frameRect(50,50,250,250,128,128,64,0xfefefefe); draw(&bdraw); MKDIR(".\\bmp",S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); bdraw.copyToFile(X(".\\bmp\\test1_app.bmp")); }
void test_bmpImage_class::test12(void) { _START(); _INFO("verifica interrna alla classe:metodo landscape"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(50, 100,24, 255); CA_ASSERT((int)s.getWidth()==50); CA_ASSERT((int)s.getHeight() == 100); s.landscape(false); CA_ASSERT((int)s.getWidth()== 100); CA_ASSERT((int)s.getHeight()== 50); }
bool AABB::IsContainPoint(const Vector3F &pos) const { CA_ASSERT( min.IsValid(), "IsContainPoint() : min is not valid"); CA_ASSERT( max.IsValid(), "IsContainPoint() : max is not valid"); CA_ASSERT( pos.IsValid(), "IsContainPoint() : pos is not valid"); if (pos.x < min.x) return false; if (pos.y < min.y) return false; if (pos.z < min.z) return false; if (pos.x > max.x) return false; if (pos.y > max.y) return false; if (pos.z > max.z) return false; return true; }
bool AABB::IsContainSphere(const Vector3F &pos,float radius) const { CA_ASSERT( min.IsValid(), "IsContainSphere() : min is not valid"); CA_ASSERT( max.IsValid(), "IsContainSphere() : max is not valid"); CA_ASSERT( pos.IsValid(), "IsContainSphere() : pos is not valid"); if (pos.x-radius < min.x) return false; if (pos.y-radius < min.y) return false; if (pos.z-radius < min.z) return false; if (pos.x+radius > max.x) return false; if (pos.y+radius > max.y) return false; if (pos.z+radius > max.z) return false; return true; }
void test_bmpImage_class::test4(void) { _START(); _INFO("verifica interrna alla classe : struttura bitmapfileinfo"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); LPBITMAPINFOHEADER v = s.getInfoHeader(); CA_ASSERT(v != NULL); CA_ASSERT(v->biBitCount == 24); CA_ASSERT(v->biHeight == 100); CA_ASSERT(v->biWidth == 100); draw(&s); }
void GLShader::SetParameter(const std::string& Name, const ITextureBase* Value) { CA_ASSERT(dynamic_cast<const GLTexture *>(Value) != nullptr, "GLShader::SetParameter() : ITextureBase is not a GLTexture"); GLuint paramID = glGetUniformLocation(m_ProgramID, Name.c_str()); glUniform1i(paramID, 0); // unit texture }
CEGUI::Texture& CEGUITextureTarget::getTexture() const { CA_ASSERT(m_pTexture != nullptr, "CEGUITextureTarget::getTexture() : m_pTexture is nullptr"); CasaEngine::TextureTarget *pTarget = dynamic_cast<CasaEngine::TextureTarget *>(m_pRenderTarget); m_pTexture->SetTexture(pTarget->GetTexture()); return *m_pTexture; }
bool AABB::IsIntersectBox(const AABB &b) const { CA_ASSERT( min.IsValid(), "IsIntersectBox() : min is not valid"); CA_ASSERT( max.IsValid(), "IsIntersectBox() : max is not valid"); CA_ASSERT( b.min.IsValid(), "IsIntersectBox() : b.min is not valid"); CA_ASSERT( b.max.IsValid(), "IsIntersectBox() : b.max is not valid"); // Check for intersection on X axis. if ((min.x > b.max.x)||(b.min.x > max.x)) return false; // Check for intersection on Y axis. if ((min.y > b.max.y)||(b.min.y > max.y)) return false; // Check for intersection on Z axis. if ((min.z > b.max.z)||(b.min.z > max.z)) return false; // Boxes overlap in all 3 axises. return true; }
///////////////////////////////////////////////////////////// /// Met à jour les pixels de la texture /// /// \param Rect : Rectangle à mettre à jour dans la texture /// //////////////////////////////////////////////////////////// void DX9Texture::Update(const CRectangle& Rect) { CA_ASSERT(CRectangle(0, 0, m_Size.x, m_Size.y).Intersects(Rect) == INT_IN, "DX9Texture::Update() : rectangle out of bounds"); // Si le format des pixels à copier est le même que celui de la texture on fait une simple copie, // sinon on effectue une conversion if (m_Format == m_Data.GetFormat()) { // Verrouillage de la texture D3DLOCKED_RECT LockedRect; RECT Lock = {Rect.Left(), Rect.Top(), Rect.Right(), Rect.Bottom()}; DXCheck(m_Texture->LockRect(0, &LockedRect, &Lock, 0)); // Copie des pixels UpdateSurface(LockedRect, Rect); // Déverrouillage de la texture m_Texture->UnlockRect(0); } else { // Récupération du device SmartPtr<IDirect3DDevice9, CResourceCOM> Device; m_Texture->GetDevice(&GetPtr(Device)); // Création d'une texture en mémoire système pour y copier les pixels SmartPtr<IDirect3DSurface9, CResourceCOM> Src; if (FAILED(Device->CreateOffscreenPlainSurface(Rect.Width(), Rect.Height(), DX9Enum::Get(m_Data.GetFormat()), D3DPOOL_SYSTEMMEM, &GetPtr(Src), nullptr))) throw DX9Exception("CreateOffscreenPlainSurface", "DX9Texture::Update"); // Verrouillage de la texture temporaire D3DLOCKED_RECT LockedRect; Src->LockRect(&LockedRect, nullptr, 0); // Copie des pixels UpdateSurface(LockedRect, Rect); // Déverrouillage de la texture temporaire Src->UnlockRect(); // Récupération de la surface de niveau 0 de la texture SmartPtr<IDirect3DSurface9, CResourceCOM> Dest; m_Texture->GetSurfaceLevel(0, &GetPtr(Dest)); // Copie de la surface Src sur la surface Dest (c'est ici qu'est effectuée la conversion de format) RECT DestRect = {Rect.Left(), Rect.Top(), Rect.Right(), Rect.Bottom()}; if (FAILED(D3DXLoadSurfaceFromSurface(Dest, nullptr, &DestRect, Src, nullptr, nullptr, D3DX_DEFAULT, 0))) throw DX9Exception("D3DXLoadSurfaceFromSurface", "DX9Texture::Update"); } // Génération des niveaux de mipmapping si nécessaire if (m_HasMipmaps) { if (m_AutoMipmaps) m_Texture->GenerateMipSubLevels(); else D3DXFilterTexture(m_Texture, nullptr, D3DX_DEFAULT, D3DX_DEFAULT); } }
void test_bmpImage_class::test11(void) { _START(); _INFO("verifica interrna alla classe:metodo portrait"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 50,24, 255); CA_ASSERT((int)s.getWidth()==100); CA_ASSERT((int)s.getHeight()== 50); draw(&s); s.portrait(false); CA_ASSERT((int)s.getWidth()==50); CA_ASSERT((int)s.getHeight()==100); draw(&s); }
bool AABB::IsOverlapSphereBounds(const Vector3F &pos, float radius) const { CA_ASSERT( min.IsValid(), "IsOverlapSphereBounds() : min is not valid"); CA_ASSERT( max.IsValid(), "IsOverlapSphereBounds() : max is not valid"); CA_ASSERT( pos.IsValid(), "IsOverlapSphereBounds() : pos is not valid"); if (pos.x > min.x && pos.x < max.x && pos.y > min.y && pos.y < max.y && pos.z > min.z && pos.z < max.z) return true; if (pos.x+radius < min.x) return false; if (pos.y+radius < min.y) return false; if (pos.z+radius < min.z) return false; if (pos.x-radius > max.x) return false; if (pos.y-radius > max.y) return false; if (pos.z-radius > max.z) return false; return true; }
void test_app_manager::test2(void) { _START(); _INFO("Verify of internal class nnAppManager:load and display a draw, and scroll it"); _AUTHOR("Coppi Angelo n2draw library "); _STOP(); nnAppManager app; #ifdef _UNICODE STRING name(X("conf_utf16.xml")); #else STRING name(X("conf_ut8.xml")); #endif STRING path("./"); IChild *childs = app.createObjects(name,path); CA_ASSERT(childs != nullptr); bool res; res = childs->getImage()->loadImages(); CA_ASSERT(res == true); nnContactNO *v = new nnContactNO(); nnObjManager *mn = dynamic_cast<nnObjManager *>(childs->getManager()); res = mn->addContact(10, 0, v); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)1); nnGenericCoil *u = new nnGenericCoil(); res = mn->addCoil(10, u); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)20); nnContactNC *v1 = new nnContactNC(); res = mn->addContact(12, 0, v1); CA_ASSERT(res == true); nnPoint p1(12, 0); nnPoint p2(10, 0); nnConnection::connectComponent(childs->getManager(), p2, p1); res = childs->getView()->updateDraw(); CA_ASSERT(res == true); bmpImage &bdraw = childs->getView()->getDraw(); draw(&bdraw); childs->getView()->handlerScrollHorz(2); res = childs->getView()->updateDraw(); //CA_ASSERT(res == true); bdraw = childs->getView()->getDraw(); draw(&bdraw); childs->getView()->handlerScrollVert(2); res = childs->getView()->updateDraw(); CA_ASSERT(res == true); bdraw = childs->getView()->getDraw(); draw(&bdraw); }
void test_bmpImage_class::test7(void) { _START(); _INFO("verifica interrna alla classe : metodo isValid()"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); CA_ASSERT(s.isValid()==true); }
CEGUIViewportTarget::CEGUIViewportTarget(ViewportTarget *pViewportTarget_) : CEGUIRenderTarget<>(pViewportTarget_) { CA_ASSERT(pViewportTarget_ != nullptr, "CEGUIViewportTarget() : ViewportTarget is nullptr"); //m_pRenderTarget = pViewportTarget_; m_Area.d_min.d_x = static_cast<float>(pViewportTarget_->GetArea().Origin.x); m_Area.d_min.d_y = static_cast<float>(pViewportTarget_->GetArea().Origin.y); m_Area.d_max.d_x = static_cast<float>(pViewportTarget_->GetArea().Width()); m_Area.d_max.d_y = static_cast<float>(pViewportTarget_->GetArea().Height()); }
void Animation::Update(float elapsedTime_) { CA_ASSERT(m_bIsInitialized == true, "Animation::Update() : call Initialize before Update()"); if (m_TotalTime == 0.0f) // no event do nothing { return; } bool isFinished = false; float lastTime = m_CurrentTime; m_CurrentTime += elapsedTime_; if (m_Loop == true) { //always between 0 <= current time <= TotalTime while(m_CurrentTime > m_TotalTime) { m_CurrentTime -= m_TotalTime; isFinished = true; } } else if (m_CurrentTime > m_TotalTime) { m_CurrentTime = m_TotalTime; isFinished = true; } if (isFinished == true) { fireEvent(AnimationFinishedEvent::GetEventName(), AnimationFinishedEvent(GetName().c_str()));//AnimationFinishedEvent(ID())); } std::vector<AnimationEvent *>::iterator it; //std::vector<AnimationEvent> activeEvents; // m_Events must be sorted by time for (it = m_Events.begin(); it != m_Events.end(); it++) { // we activate only event between the last time // and the current time if (lastTime > (*it)->Time() && (*it)->Time() <= m_CurrentTime) { (*it)->Activate(this); //activeEvents.push_back(it); } } }
void GameInfo::SetActiveCamera(CameraComponent *val) { CA_ASSERT(val != nullptr, "GameInfo::SetActiveCamera() : camera is nullptr"); m_pCamera = val; Viewport &viewport = m_pCamera->GetViewport(); bgfx::setViewRect(0, viewport.X() * Game::Instance()->GetWindow()->getSize().x, viewport.Y() * Game::Instance()->GetWindow()->getSize().y, viewport.Width() * Game::Instance()->GetWindow()->getSize().x, viewport.Height() * Game::Instance()->GetWindow()->getSize().y); }
void test_bmpImage_class::test5(void) { _START(); _INFO("verifica interrna alla classe : metodi copytofile and copyfromfile"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); remove("./whiteImage.bmp"); bmpImage s; s.create(100, 100,32, 255); s.frameRect(10,10,90,90,255,0,0,0xffffffff); draw(&s); bool res = s.copyToFile(X("./whiteImage.bmp")); CA_ASSERT(res==true); bmpImage t; t.copyFromFile(X("./whiteImage.bmp")); CA_ASSERT((LPBITMAPFILEHEADER)s!=NULL); CA_ASSERT((LPBITMAPFILEHEADER)t!=NULL); int res1 = memcmp((LPBITMAPFILEHEADER)s, (LPBITMAPFILEHEADER)t, ((LPBITMAPFILEHEADER)(s))->bfSize); CA_ASSERT(res1==0); draw(&t); //remove("./whiteImage.bmp"); }
void test_bmpImage_class::test10(void) { _START(); _INFO("verifica interrna alla classe: create attach clear"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); bmpImage t; t.create(100, 100,24, 255); LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s; t.clear(); t.attach(s); CA_ASSERT(v == (LPBITMAPFILEHEADER)t); }
void test_bmpImage_class::test6(void) { _START(); _INFO("verifica interrna alla classe: metodo copyfrom bmpImage"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); bmpImage v; v.copyFrombmpImage(s); int res = memcmp((LPBITMAPFILEHEADER)s, (LPBITMAPFILEHEADER)v, ((LPBITMAPFILEHEADER)(s))->bfSize); CA_ASSERT(res== 0); draw(&v); }
void SetFrameEvent::Activate(Animation *pAnim_) { CA_ASSERT(pAnim_ != nullptr, "SetFrameEvent::Activate() : Animation is nullptr"); Animation2D *pAnim2D = static_cast<Animation2D *>(pAnim_); if (pAnim2D != nullptr) { pAnim2D->CurrentFrame(m_FrameID.c_str()); } else { CA_ERROR("SetFrameEvent.Activate() : Animation(%d - %s) is not a Animation2D\n", pAnim_->ID(), pAnim_->GetName().c_str()); } }
/// <summary> /// Transforms an array of vectors by a quaternion rotation. /// </summary> /// <param name="sourceArray">The vectors to transform</param> /// <param name="rotation">The quaternion to rotate the vector by.</param> /// <param name="destinationArray">The result of the operation.</param> void Quaternion::Transform(const std::vector<Vector3F> &sourceArray, std::vector<Vector3F> &destinationArray) const { CA_ASSERT(destinationArray.size() >= sourceArray.size(), "The destination array is smaller than the source array."); int i = 0; for (std::vector<Vector3F>::const_iterator it = sourceArray.cbegin(); it != sourceArray.cend(); it++) { Vector3F position = *it; float x = 2 * (this->y * position.z - this->z * position.y); float y = 2 * (this->z * position.x - this->x * position.z); float z = 2 * (this->x * position.y - this->y * position.x); destinationArray[i] = Vector3F( position.x + x * this->w + (this->y * z - this->z * y), position.y + y * this->w + (this->z * x - this->x * z), position.z + z * this->w + (this->x * y - this->y * x)); i++; } }
///////////////////////////////////////////////////////////// /// Met à jour les pixels de la texture /// /// \param Rect : Rectangle à mettre à jour dans la texture /// //////////////////////////////////////////////////////////// void GLTexture::Update(const CRectangle& Rect) { CA_ASSERT(CRectangle(0, 0, m_Size.x, m_Size.y).Intersects(Rect) != INT_OUT, "GLTexture::Update() : rectangle out of bounds"); GLCheck(glBindTexture(GL_TEXTURE_2D, m_Texture)); GLEnum::TPixelFmt TexFmt = GLEnum::Get(m_Format); GLEnum::TPixelFmt ImgFmt = GLEnum::Get(m_Data.GetFormat()); if (FormatCompressed(m_Data.GetFormat())) { #if CA_PLATFORM_DESKTOP // Format de pixel compressé - on utilise une extension pour uploader les pixels unsigned long DataSize = Rect.Width() * Rect.Height() * GetBytesPerPixel(m_Data.GetFormat()); if (Rect.Width() == m_Size.x && Rect.Height() == m_Size.y) { // Le rectangle source couvre la totalité de l'image : on envoie directement les données GLRenderer::glCompressedTexSubImage2DARB(GL_TEXTURE_2D, 0, Rect.Left(), Rect.Top(), Rect.Width(), Rect.Height(), ImgFmt.Format, DataSize, m_Data.GetData()); } else { // Le rectangle source ne couvre qu'une partie de l'image : on envoie une sous-image de l'image en mémoire CImage SubData = m_Data.SubImage(Rect); GLRenderer::glCompressedTexSubImage2DARB(GL_TEXTURE_2D, 0, Rect.Left(), Rect.Top(), Rect.Width(), Rect.Height(), ImgFmt.Format, DataSize, SubData.GetData()); } #else throw NEW_AO CNotImplementedException("GLTexture::Update() : compressed format is not supported\n"); #endif // CA_PLATFORM_DESKTOP } else { GLint pixelStore = 0; switch (m_Data.GetFormat()) { case PixelFormat::L_8: ///< Luminosity 8 bits (1 byte) pixelStore = 1; break; case PixelFormat::AL_88: ///< Alpha and luminosity 16 bits (2 bytes) case PixelFormat::ARGB_1555: ///< RGB 16 bits 1555 (2 bytes) case PixelFormat::ARGB_4444: ///< RGB 16 bits 4444 (2 bytes) case PixelFormat::PVRTC2: ///< PVR texture compression. Each pixel is 2 bits. pixelStore = 2; break; case PixelFormat::RGB_888: ///< RGB 24 bits 888 (3 bytes) case PixelFormat::RGB_DXT1: ///< S3 DXT1 texture compression (RGB) // case PixelFormat::ARGB_8888: ///< ARGB 32 bits 8888 (4 bytes) case PixelFormat::PVRTC4: ///< PVR texture compression. Each pixel is 4 bits. case PixelFormat::RGBA_DXT1: ///< S3 DXT1 texture compression (RGBA) case PixelFormat::RGBA_DXT3: ///< S3 DXT3 texture compression (RGBA) case PixelFormat::RGBA_DXT5: ///< S3 DXT5 texture compression (RGBA) pixelStore = 4; break; } GLCheck(glPixelStorei(GL_PACK_ALIGNMENT, pixelStore)); if (!m_HasMipmaps || m_AutoMipmaps) { // Pas de mipmap ou génération hardware : on ne met à jour que le premier niveau if ((Rect.Width() == m_Size.x) && (Rect.Height() == m_Size.y)) { GLCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, Rect.Width(), Rect.Height(), ImgFmt.Format, ImgFmt.Type, m_Data.GetData())); } else { CImage SubData = m_Data.SubImage(Rect); GLCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, Rect.Left(), Rect.Top(), Rect.Width(), Rect.Height(), ImgFmt.Format, ImgFmt.Type, SubData.GetData())); } } else { #if CA_PLATFORM_DESKTOP // Plusieurs niveaux de mipmapping et génération software : on met à jour tous les niveaux GLCheck(gluBuild2DMipmaps(GL_TEXTURE_2D, TexFmt.Internal, m_Size.x, m_Size.y, ImgFmt.Format, ImgFmt.Type, m_Data.GetData())); #else if ((Rect.Width() == m_Size.x) && (Rect.Height() == m_Size.y)) { GLCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, Rect.Width(), Rect.Height(), ImgFmt.Format, ImgFmt.Type, m_Data.GetData())); } else { CImage SubData = m_Data.SubImage(Rect); GLCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, Rect.Left(), Rect.Top(), Rect.Width(), Rect.Height(), ImgFmt.Format, ImgFmt.Type, SubData.GetData())); } #endif // CA_PLATFORM_DESKTOP GLCheck(glGenerateMipmap(GL_TEXTURE_2D)); } } GLCheck(glBindTexture(GL_TEXTURE_2D, 0)); }
void MovingEntity2DComponent::Initialize() { m_pSteering = GetEntity()->GetComponentMgr()->GetComponent<SteeringBehaviorComponent>(); CA_ASSERT(m_pSteering != nullptr, "MovingEntity2DComponent::Initialize() can't find the SteeringBehaviorComponent. Please add it before add a MovingEntity2DComponent"); }