bool CScene::RenderShadow() { std::list<axelynx::Camera *>::const_iterator ci = camlist.begin(); std::list<axelynx::Camera *>::const_iterator ei = camlist.end(); CShadowPass::SetShadowShader(defShader_); CShadowPass::StartPass(); for(;ci!=ei;++ci) { if((*ci)->isEnabled()) { frame_++; (*ci)->Bind(zpassed?-1:0); CMaterial::Free(); //материал зависит от камеры if(zpassed) { CEarlyZ::StartRenderPass(); } else { glDepthFunc(GL_LESS); glDepthMask(GL_TRUE); } for(int i=0;i<256;++i) { if(visible_groups_[i]) scenegraph_[i]->Render(*ci); } (*ci)->UnBind(); CMaterial::Free(); //материал зависит от камеры } } CShader *cs = CShader::Current(); if(cs) cs->UnBind(); for(int i=0;i<16;++i) { CTexture *ct = CTexture::Current(i); if(ct) ct->UnBind(); } if(zpassed) CEarlyZ::EndRenderPass(); zpassed = false; glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glDepthMask(GL_TRUE); CShadowPass::EndPass(); return true; }
void CTexture::Swap( CTexture &tsrc ) { CTexture temp; temp.Copy( *this ); Copy( tsrc ); tsrc.Copy( temp ); temp.Init(); }
void TextureReset(void) { textures_done = false; build_time = 0; for (CTexture* t = tHead; t; t = t->_next) t->Clear(); memset(prefix_used, 0, sizeof (prefix_used)); memset(name_used, 0, sizeof (name_used)); memset(suffix_used, 0, sizeof (suffix_used)); }
bool CPicture::CreateTiledThumb(const std::vector<std::string> &files, const std::string &thumb) { if (!files.size()) return false; unsigned int num_across = (unsigned int)ceil(sqrt((float)files.size())); unsigned int num_down = (files.size() + num_across - 1) / num_across; unsigned int tile_width = g_advancedSettings.m_thumbSize / num_across; unsigned int tile_height = g_advancedSettings.m_thumbSize / num_down; unsigned int tile_gap = std::max(1,g_advancedSettings.m_thumbSize / 512); // create a buffer for the resulting thumb uint32_t *buffer = (uint32_t *)calloc(g_advancedSettings.m_thumbSize * g_advancedSettings.m_thumbSize, 4); for (unsigned int i = 0; i < files.size(); ++i) { int x = i % num_across; int y = i / num_across; // load in the image CTexture texture; unsigned int width = tile_width - 2*tile_gap, height = tile_height - 2*tile_gap; if (texture.LoadFromFile(files[i], width, height, g_guiSettings.GetBool("pictures.useexifrotation")) && texture.GetWidth() && texture.GetHeight()) { GetScale(texture.GetWidth(), texture.GetHeight(), width, height); // scale appropriately uint32_t *scaled = new uint32_t[width * height]; if (ScaleImage(texture.GetPixels(), texture.GetWidth(), texture.GetHeight(), texture.GetPitch(), (uint8_t *)scaled, width, height, width * 4)) { if (!texture.GetOrientation() || OrientateImage(scaled, width, height, texture.GetOrientation())) { // drop into the texture unsigned int posX = x*tile_width + (tile_width - width)/2; unsigned int posY = y*tile_height + (tile_height - height)/2; uint32_t *dest = buffer + posX + posY*g_advancedSettings.m_thumbSize; uint32_t *src = scaled; for (unsigned int y = 0; y < height; ++y) { memcpy(dest, src, width*4); dest += g_advancedSettings.m_thumbSize; src += width; } } } delete[] scaled; } } // now save to a file bool ret = CreateThumbnailFromSurface((uint8_t *)buffer, g_advancedSettings.m_thumbSize, g_advancedSettings.m_thumbSize, g_advancedSettings.m_thumbSize * 4, thumb); free(buffer); return ret; }
bool BitmapLoaded (int bmi, int bD1) { CBitmap* bmoP, * bmP = gameData.pig.tex.bitmaps [bD1] + bmi; CTexture* texP; #if 1 if (bmP->Flags () & BM_FLAG_PAGED_OUT) return false; if ((bmoP = bmP->Override (-1))) bmP = bmoP; #endif return ((texP = bmP->Texture ()) && (texP->Handle ())) || (bmP->Buffer () != 0); }
void TextureReset (void) { textures_done = false; build_time = 0; for (CTexture* t = head; t; t = t->_next) t->Clear (); ZeroMemory (prefix_used, sizeof (prefix_used)); ZeroMemory (name_used, sizeof (name_used)); ZeroMemory (suffix_used, sizeof (suffix_used)); }
void CPickup::Initalise(CVector3f p) { m_isActive = true; m_theta = 0.0f; m_position = p; CTexture texture; // Texture - https://www.textures.com/download/cliffs0174/56219?secure=login texture.Load("Resources\\Textures\\rock.jpg", false); m_textureID = texture.m_textureID; }
bool CTextureDDSJob::DoWork() { CTexture texture; if (URIUtils::GetExtension(m_original).Equals(".dds")) return false; if (texture.LoadFromFile(m_original)) { // convert to DDS CDDSImage dds; CLog::Log(LOGDEBUG, "Creating DDS version of: %s", m_original.c_str()); return dds.Create(URIUtils::ReplaceExtension(m_original, ".dds"), texture.GetWidth(), texture.GetHeight(), texture.GetPitch(), texture.GetPixels(), 40); } return false; }
void CUICustomItem::Render(FVF::TL*& Pointer, const Fvector2& pos, u32 color, float x1, float y1, float x2, float y2) { CTexture* T = RCache.get_ActiveTexture(0); Fvector2 ts; ts.set (float(T->get_Width()),float(T->get_Height())); if (!(uFlags&flValidRect)){ SetRect (0,0,ts.x,ts.y); } if (!(uFlags&flValidOriginalRect)){ iOriginalRect.set(0,0,ts.x,ts.y); uFlags |= flValidOriginalRect; } Fvector2 LTp,RBp; Fvector2 LTt,RBt; //координаты на экране в пикселях UI()->ClientToScreenScaled (LTp, x1,y1); LTp.add (pos); UI()->ClientToScreenScaled (RBp, x2,y2); RBp.add (pos); //текстурные координаты LTt.set ( iOriginalRect.x1/ts.x, iOriginalRect.y1/ts.y); RBt.set ( iOriginalRect.x2/ts.x, iOriginalRect.y2/ts.y); // Check mirror mode if (tmMirrorHorisontal == eMirrorMode || tmMirrorBoth == eMirrorMode) std::swap (LTt.x,RBt.x); if (tmMirrorVertical == eMirrorMode || tmMirrorBoth == eMirrorMode) std::swap (LTt.y,RBt.y); // clip poly sPoly2D S; S.resize(4); S[0].set (LTp.x-0.5f,LTp.y-0.5f, LTt.x,LTt.y); // LT S[1].set (RBp.x-0.5f,LTp.y-0.5f, RBt.x,LTt.y); // RT S[2].set (RBp.x-0.5f,RBp.y-0.5f, RBt.x,RBt.y); // RB S[3].set (LTp.x-0.5f,RBp.y-0.5f, LTt.x,RBt.y); // LB sPoly2D D; // const C2DFrustum& FF = UI()->ScreenFrustum(); sPoly2D* R = UI()->ScreenFrustum().ClipPoly(S,D); // sPoly2D* R = &S; if (R&&R->size()){ for (u32 k=0; k<R->size()-2; k++){ Pointer->set ((*R)[0+0].pt.x, (*R)[0+0].pt.y, color, (*R)[0+0].uv.x, (*R)[0+0].uv.y); Pointer++; Pointer->set ((*R)[k+1].pt.x, (*R)[k+1].pt.y, color, (*R)[k+1].uv.x, (*R)[k+1].uv.y); Pointer++; Pointer->set ((*R)[k+2].pt.x, (*R)[k+2].pt.y, color, (*R)[k+2].uv.x, (*R)[k+2].uv.y); Pointer++; } } }
void CStaticMesh::ClearTextureVector(std::vector<CTexture*>& textVector) { for(uint16 i = 0; i < textVector.size(); ++i) { CTexture* texture = textVector[i]; if(!CORE->GetTextureManager()->RemoveResource(texture->GetName())) { CHECKED_DELETE(texture); } } textVector.clear(); }
virtual void Update() { PROFILE("CAppTask::Update()", 1); glClearColor(0.253f, 0.47f, 0.683f, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPolygonMode(GL_FRONT, m_nPolygonMode); if(m_nPolygonMode == GL_FILL) { glEnable(GL_BLEND); glDepthFunc(GL_ALWAYS); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1, 1, 1, 1); m_tex.Enable(); } CSRTTransform camera = CCameraTask::GetPtr()->GetCamera(); int i, j; #define LEVEL 10 const int nCubes = LEVEL*LEVEL*LEVEL; CProjectedCube cube[nCubes]; float fDistance[nCubes]; for(i=0; i<nCubes; i++) { cube[i].SetPosition(CVector(i/(LEVEL*LEVEL)*2, ((i/LEVEL)%LEVEL)*2, (i%LEVEL)*2)); fDistance[i] = cube[i].GetPosition().Distance(camera.GetPosition()); } int nOrder[nCubes]; for(i=0; i<nCubes; i++) nOrder[i] = i; for(i=0; i<nCubes; i++) { for(j=0; j<nCubes-i-1; j++) { if(fDistance[nOrder[j]] > fDistance[nOrder[j+1]]) { int nTemp = nOrder[j]; nOrder[j] = nOrder[j+1]; nOrder[j+1] = nTemp; } } } for(i=0; i<nCubes; i++) cube[nOrder[nCubes-1-i]].DrawVolume(camera); m_tex.Disable(); glDisable(GL_BLEND); glPolygonMode(GL_FRONT, GL_FILL); }
/* TextureXPanel::openTEXTUREX * Loads a TEXTUREx or TEXTURES format texture list into the editor *******************************************************************/ bool TextureXPanel::openTEXTUREX(ArchiveEntry* entry) { // Open texture list (check format) if (entry->getType()->getFormat() == "texturex") { // TEXTURE1/2 format if (!texturex.readTEXTUREXData(entry, tx_editor->patchTable())) return false; // Create default texture editor texture_editor = new TextureEditorPanel(this, tx_editor); // Update patch table usage info for (size_t a = 0; a < texturex.nTextures(); a++) { CTexture* tex = texturex.getTexture(a); // Go through texture's patches for (size_t p = 0; p < tex->nPatches(); p++) tx_editor->patchTable().patch(tex->getPatch(p)->getName()).used_in.push_back(tex->getName()); } } else { // TEXTURES format if (!texturex.readTEXTURESData(entry)) return false; // Create extended texture editor texture_editor = new ZTextureEditorPanel(this, tx_editor); // Add 'type' column list_textures->InsertColumn(2, "Type"); } tx_entry = entry; // Add texture editor area GetSizer()->Add(texture_editor, 1, wxEXPAND|wxALL, 4); texture_editor->setupLayout(); // Update format label label_tx_format->SetLabel("Format: " + texturex.getTextureXFormatString()); // Update texture list list_textures->updateList(); return true; }
void CSDLOpenGLWindow::ReleaseScene() { spTextured.DeleteProgram(); spColored.DeleteProgram(); shFragmentTex.DeleteShader(); shFragmentCol.DeleteShader(); shVertexTex.DeleteShader(); shVertexCol.DeleteShader(); glDeleteVertexArrays(2, uiVAOs); vboSceneObjects.DeleteVBO(); tBox.DeleteTexture(); tBlueIce.DeleteTexture(); }
bool CTexture::createTexture(const char* a_sFileName) { CTexture* temp = CTexMgr->createTexture(a_sFileName); if (temp == NULL) return false; this->_fileName = temp->getFileName(); this->_imgInfo = temp->getImgInfo(); this->_rect = temp->getRect(); this->_texture = temp->getTexture(); return true; }
void CTriangle::Render( uint32 i_iPass ) { switch( i_iPass ) { case ePass_Lighting: break; } CGraphics *pGraphics = m_pParent->pGetParent()->pGetGraphics(); CCamera *pCurCamera = pGraphics->pGetCurCamera(); matrix44 matWorld; matMatrix44Identity( matWorld ); pCurCamera->SetWorldMatrix( matWorld ); m_pVertexShader->SetMatrix( m3dsc_worldmatrix, pCurCamera->matGetWorldMatrix() ); m_pVertexShader->SetMatrix( m3dsc_viewmatrix, pCurCamera->matGetViewMatrix() ); m_pVertexShader->SetMatrix( m3dsc_projectionmatrix, pCurCamera->matGetProjectionMatrix() ); m_pVertexShader->SetMatrix( m3dsc_wvpmatrix, pCurCamera->matGetWorldMatrix() * pCurCamera->matGetViewMatrix() * pCurCamera->matGetProjectionMatrix() ); vector3 vCamPos = pCurCamera->vGetPosition(); m_pVertexShader->SetVector( 0, vector4( vCamPos.x, vCamPos.y, vCamPos.z, 0 ) ); CLight *pLight = m_pParent->pGetCurrentLight(); vector3 vLightPos = pLight->vGetPosition(); m_pVertexShader->SetVector( 1, vector4( vLightPos.x, vLightPos.y, vLightPos.z, 0 ) ); m_pPixelShader->SetVector( 0, pLight->vGetColor() ); pGraphics->SetVertexFormat( m_pVertexFormat ); pGraphics->SetVertexStream( 0, m_pVertexBuffer, 0, sizeof( vertexformat ) ); pGraphics->SetVertexShader( m_pVertexShader ); pGraphics->SetPixelShader( m_pPixelShader ); CResManager *pResManager = m_pParent->pGetParent()->pGetResManager(); CTexture *pTexture = (CTexture *)pResManager->pGetResource( m_hTexture ); pGraphics->SetTexture( 0, pTexture->pGetTexture() ); CTexture *pNormalmap = (CTexture *)pResManager->pGetResource( m_hNormalmap ); pGraphics->SetTexture( 1, pNormalmap->pGetTexture() ); for( uint32 i = 0; i < 2; ++i ) { pGraphics->SetTextureSamplerState( i, m3dtss_addressu, m3dta_clamp ); pGraphics->SetTextureSamplerState( i, m3dtss_addressv, m3dta_clamp ); } pGraphics->pGetM3DDevice()->DrawPrimitive( m3dpt_trianglelist, 0, 1 ); }
protected: void update(int dt) { mUpdateProgram->enable(); mUpdateProgram->setUniform("u_fTime", (float)mTime); mUpdateProgram->setUniform("u_fDeltaTime", (float)dt); mRandomTexture->bind(OGL_TEXTURE_GENERIC); glEnable(GL_RASTERIZER_DISCARD); glBindBuffer(GL_ARRAY_BUFFER, mVBOs[mActiveVBO]); glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, mTBOs[mActiveTBO]); glBindVertexArray(mVAOs[0]); glBeginTransformFeedback(GL_POINTS); /////////////////////////////////////////////////////////////////////////// if(mFirst) { glDrawArrays(GL_POINTS, 0, 1); mFirst = false; } else { glDrawTransformFeedback(GL_POINTS, mTBOs[mActiveVBO]); } glEndTransformFeedback(); ////////////////////////////////////////////////////////////////////////////////////// // glExitIfError(); glBindVertexArray(0); glDisable(GL_RASTERIZER_DISCARD);
CQuad::CQuad(const CTexture & texture) { const float w = texture.getWidth(); const float h = texture.getHeight(); x0= y0= 0.0f; x1= w; y1= h; u0= v0 = 0.0f; if (texture.target() == GL_TEXTURE_2D) u1= v1 = 1.0f; else { u1 = w; v1 = h; } }
CMaterial::CMaterial(CXMLTreeNode &TreeNode) : CNamed(TreeNode) { std::string l_EffectTechnique = TreeNode.GetPszProperty("effect_technique"); m_EffectTechnique = CEngine::GetSingletonPtr()->GetEffectManager()->GetResource(l_EffectTechnique); if (l_EffectTechnique == "diffuse_technique") { for (int i = 0; i < TreeNode.GetNumChildren(); ++i) { CXMLTreeNode l_Texture = TreeNode(i); CTexture * Texture = new CTexture(); Texture->Load(l_Texture.GetPszProperty("filename")); m_Textures.push_back(Texture); } } }
bool CRenderTarget::Bind3DTexture(axelynx::Texture* tex, int texlayer, int rendertargetlayer) { OPENGL_CHECK_FOR_ERRORS(); glBindFramebuffer(GL_FRAMEBUFFER, fbo_); OPENGL_CHECK_FOR_ERRORS(); if(tex) { CTexture *ctex = dynamic_cast<CTexture*>(tex); glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + rendertargetlayer, GL_TEXTURE_3D, ctex->GetHandle(), 0, texlayer); used_layer_[rendertargetlayer] = true; } else { glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + rendertargetlayer, GL_TEXTURE_3D, 0, 0, texlayer); used_layer_[rendertargetlayer] = false; } OPENGL_CHECK_FOR_ERRORS(); if(current_) current_->Bind(); else glBindFramebuffer(GL_FRAMEBUFFER, 0); OPENGL_CHECK_FOR_ERRORS(); return true; }
bool CRenderTarget::BindCubemap(axelynx::Texture* tex, int side, int rendertargetlayer) { OPENGL_CHECK_FOR_ERRORS(); // указываем для текущего FBO текстуру, куда следует производить рендер глубины glBindFramebuffer(GL_FRAMEBUFFER, fbo_); if(tex) { CTexture *ctex = dynamic_cast<CTexture*>(tex); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + rendertargetlayer, GL_TEXTURE_CUBE_MAP_POSITIVE_X + side, ctex->GetHandle(), 0); used_layer_[rendertargetlayer] = true; } else { glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + rendertargetlayer, GL_TEXTURE_CUBE_MAP_POSITIVE_X + side, 0, 0); used_layer_[rendertargetlayer] = false; } if(current_) current_->Bind(); else glBindFramebuffer(GL_FRAMEBUFFER, 0); OPENGL_CHECK_FOR_ERRORS(); return true; }
// ----------------------------------------------------------------------------- // Creates a new, empty texture // ----------------------------------------------------------------------------- void TextureXPanel::newTexture() { // Prompt for new texture name string name = wxGetTextFromUser("Enter a texture name:", "New Texture"); // Do nothing if no name entered if (name.IsEmpty()) return; // Process name if (!TxListIsTextures(texturex_)) { name = name.Upper().Truncate(8); } // Create new texture CTexture* tex = new CTexture(); tex->setName(name); tex->setState(2); // Default size = 64x128 tex->setWidth(64); tex->setHeight(128); // Setup texture scale if (TxListIsTextures(texturex_)) { tex->setScale(1, 1); tex->setExtended(true); } else tex->setScale(0, 0); // Add it after the last selected item int selected = list_textures_->getItemIndex(list_textures_->getLastSelected()); if (selected == -1) selected = texturex_.nTextures() - 1; // Add to end of the list if nothing selected texturex_.addTexture(tex, selected + 1); // Record undo level undo_manager_->beginRecord("New Texture"); undo_manager_->recordUndoStep(new TextureCreateDeleteUS(this, tex, true)); undo_manager_->endRecord(true); // Update texture list list_textures_->updateList(); // Select the new texture list_textures_->clearSelection(); list_textures_->selectItem(selected + 1); list_textures_->EnsureVisible(selected + 1); // Update variables modified_ = true; }
bool CSkybox::Create(const char *bmpDirectory, const float fSize) { // Load textures CTexture texture; //skybox texture "grave" from redsorceress.com texture.Load("Resources\\Textures\\grave_back.bmp", true); m_textureIDs[SKYBOX_BACK_ID] = texture.m_textureID; texture.Load("Resources\\Textures\\grave_front.bmp", true); m_textureIDs[SKYBOX_FRONT_ID] = texture.m_textureID; texture.Load("Resources\\Textures\\grave_top.bmp", true); m_textureIDs[SKYBOX_BOTTOM_ID] = texture.m_textureID; texture.Load("Resources\\Textures\\grave_top.bmp", true); m_textureIDs[SKYBOX_TOP_ID] = texture.m_textureID; texture.Load("Resources\\Textures\\grave_right.bmp", true); m_textureIDs[SKYBOX_LEFT_ID] = texture.m_textureID; texture.Load("Resources\\Textures\\grave_left.bmp", true); m_textureIDs[SKYBOX_RIGHT_ID] = texture.m_textureID; return true; }
bool CTextureManager::Check (void) { CTexture* texP = m_textures; int i = 0; while (texP) { if (!texP->Check ()) { TextureError (); return false; } texP = texP->Next (); i++; } if (i != m_nTextures) { TextureError (); return false; } return true; }
void CBubble::Render( uint32 i_iPass ) { switch( i_iPass ) { case ePass_Default: break; } CGraphics *pGraphics = m_pParent->pGetParent()->pGetGraphics(); CCamera *pCurCamera = pGraphics->pGetCurCamera(); matrix44 matWorld; matMatrix44Identity( matWorld ); pCurCamera->SetWorldMatrix( matWorld ); m_pVertexShader->SetMatrix( m3dsc_worldmatrix, pCurCamera->matGetWorldMatrix() ); m_pVertexShader->SetMatrix( m3dsc_viewmatrix, pCurCamera->matGetViewMatrix() ); m_pVertexShader->SetMatrix( m3dsc_projectionmatrix, pCurCamera->matGetProjectionMatrix() ); m_pVertexShader->SetMatrix( m3dsc_wvpmatrix, pCurCamera->matGetWorldMatrix() * pCurCamera->matGetViewMatrix() * pCurCamera->matGetProjectionMatrix() ); CResManager *pResManager = m_pParent->pGetParent()->pGetResManager(); CTexture *pRainbowFilm = (CTexture *)pResManager->pGetResource( m_hRainbowFilm ); pGraphics->SetTexture( 0, pRainbowFilm->pGetTexture() ); CTexture *pEnvironment = (CTexture *)pResManager->pGetResource( m_hEnvironment ); pGraphics->SetTexture( 1, pEnvironment->pGetTexture() ); m_pVertexShader->SetFloat( 0, pGraphics->pGetParent()->fGetElapsedTime() ); m_pVertexShader->SetVector( 0, pCurCamera->vGetPosition() ); pGraphics->SetVertexFormat( m_pVertexFormat ); pGraphics->SetVertexStream( 0, m_pVertexBuffer, 0, sizeof( vertexformat ) ); pGraphics->SetIndexBuffer( m_pIndexBuffer ); pGraphics->SetVertexShader( m_pVertexShader ); pGraphics->SetPixelShader( m_pPixelShader ); pGraphics->SetRenderState( m3drs_cullmode, m3dcull_cw ); pGraphics->pGetM3DDevice()->DrawIndexedPrimitive( m3dpt_trianglelist, 0, 0, m_iNumVertices, 0, m_iNumPrimitives ); pGraphics->SetRenderState( m3drs_cullmode, m3dcull_ccw ); pGraphics->pGetM3DDevice()->DrawIndexedPrimitive( m3dpt_trianglelist, 0, 0, m_iNumVertices, 0, m_iNumPrimitives ); }
bool CStaticMesh::ExtractTexture(FILE* modelFile, std::vector<CTexture*>& textVector) { assert(modelFile); uint16 length = 0; char* path; std::string sPath = ""; //Read Length of the texture path fread(&length, sizeof(uint16), 1, modelFile); path = new char[length]; memset(path, 0, length); //Read Path fread(path, 1, length, modelFile); sPath = std::string(path); CHECKED_DELETE(path); std::string texName = m_MeshName + "_" + sPath; CTexture* texture = CORE->GetTextureManager()->GetResource(texName); if(texture == NULL) { texture = new CTexture(); texture->SetName(texName); if(!texture->Load(sPath)) { CHECKED_DELETE(texture); texture = CORE->GetTextureManager()->GetNoTexture(); std::string err = "CStaticMesh::ExtractTexture->No se ha podido crear la textura: " + sPath; LOGGER->AddNewLog(ELL_WARNING, err.c_str() ); } } textVector.push_back(texture); return true; }
bool CTexDict::ReplaceTexture( const char* p_src_texture_name, CTexture* p_dst_texture ) { CTexture* pTexture = get_source_texture( p_src_texture_name ); if ( pTexture ) { bool result = pTexture->ReplaceTexture( p_dst_texture ); Dbg_MsgAssert(result, ("Can't replace texture %s with CTexture %p", p_src_texture_name, p_dst_texture)); return result; } else { // GJ: The texture checksum lookup table is only // available for sprite tex dicts, not for CAS // parts, so I've commented out the following for now... // if ( Script::GetInt( "cas_artist", false ) ) // { // Dbg_Message( "Couldn't find %s (%08x) in order to replace texture %s", p_src_texture_name, src_checksum, p_dst_texture_name ); // } Dbg_Assert( mp_texture_lookup ); /* // For debugging... if (mp_texture_lookup) { mp_texture_lookup->IterateStart(); CTexture *p_texture; int count = 0; while ((p_texture = mp_texture_lookup->IterateNext())) { Dbg_Message("Found Checksum #%d %08x", count, p_texture->GetChecksum()); count++; } Dbg_Assert( count ); } */ return false; } }
bool gen_import_cubemap(ImportOptions* opts) { CTexture *tex = new CTexture(); ImportOptions pngOpts; memset(&pngOpts, 0, sizeof(ImportOptions)); pngOpts.exporter = gen_import_cubemap_process_image; pngOpts.outpath = opts->outpath; pngOpts.expArgs = opts->expArgs; pngOpts.path = opts->path; char search_path[FILENAME_MAX]; memset(&search_path, 0, sizeof(search_path)); strcpy(search_path, opts->path); if(opts->path[strlen(opts->path)] != '/') strcat(search_path, "//"); CubemapParams params; params.tex = tex; pngOpts.extra = (void *)¶ms; FileSearcher *searcher = new FileSearcher(opts->path, cubemap_on_found_file, &pngOpts); searcher->run(); delete searcher; uint32_t checksum = crc32(0, opts->path, strlen(opts->path)); printf("%08X path\n", checksum); tex->setChecksum(checksum); CTextureCollection *tex_col = new CTextureCollection(); tex_col->AddTexture(tex); ExportOptions expOpts; memset(&expOpts, 0, sizeof(expOpts)); expOpts.path = opts->outpath; expOpts.srcPath = opts->path; expOpts.dataClass = (void *)tex_col; expOpts.extra = opts->extra; expOpts.args = opts->expArgs; opts->exporter(&expOpts); //TODO: delete the textures inside :C delete tex; return true; }
void CTextureManager::Register (CTexture* texP) { Check (); if (texP == dbgTexP) dbgTexP = dbgTexP; #if DBG CTexture* t; for (t = m_textures; t; t = t->Next ()) if (texP == t) { TextureError (); return; } #endif texP->Link (NULL, m_textures); if (m_textures) m_textures->SetPrev (texP); m_nTextures++; m_textures = texP; Check (); }
bool CWinSystemEGL::CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction) { if(!SetFullScreen(fullScreen, res, false)) return false; CTexture iconTexture; iconTexture.LoadFromFile("special://xbmc/media/icon.png"); SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture.GetPixels(), iconTexture.GetWidth(), iconTexture.GetHeight(), BPP, iconTexture.GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL); SDL_WM_SetCaption("XBMC Media Center", NULL); m_bWindowCreated = true; m_eglext = " "; m_eglext += eglQueryString(m_eglDisplay, EGL_EXTENSIONS); m_eglext += " "; CLog::Log(LOGDEBUG, "EGL_EXTENSIONS:%s", m_eglext.c_str()); return true; }
bool CScene::ZPassRender() { std::list<axelynx::Camera *>::const_iterator ci = camlist.begin(); std::list<axelynx::Camera *>::const_iterator ei = camlist.end(); CEarlyZ::StartEarlyZPass(); for(;ci!=ei;++ci) { if((*ci)->isEnabled()) { frame_++; (*ci)->Bind(); CMaterial::Free(); //материал зависит от камеры OPENGL_CHECK_FOR_ERRORS(); for(int i=0;i<256;++i) { if(visible_groups_[i]) scenegraph_[i]->Render(*ci); } (*ci)->UnBind(); CMaterial::Free(); //материал зависит от камеры } } CShader *cs = CShader::Current(); if(cs) cs->UnBind(); for(int i=0;i<16;++i) { CTexture *ct = CTexture::Current(i); if(ct) ct->UnBind(); } CEarlyZ::EndEarlyZPass(); zpassed = true; return true; }