Exemplo n.º 1
0
void CCubemapTexture::onResourceLoaded(ISharedResourceRef resource, bool success)
{
    glBindTexture(GL_TEXTURE_CUBE_MAP, m_textureId);
    
    CSharedTexture texture = std::static_pointer_cast<CTexture>(resource);
    GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
    
    if(resource == m_xpositive)
    {
        face = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
    }
    else if(resource == m_xnegative)
    {
        face = GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
    }
    else if(resource == m_ypositive)
    {
        face = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
    }
    else if(resource == m_ynegative)
    {
        face = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
    }
    else if(resource == m_zpositive)
    {
        face = GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
    }
    else if(resource == m_znegative)
    {
        face = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
    }
    
    i32 width = texture->getWidth();
    i32 height = texture->getHeight();
    const ui8* data = texture->getData();
    
	for (ui32 mip = 0; mip < texture->getNumMips() && width > 0 && height > 0; ++mip)
	{
		GLsizei size = MAX_VALUE(32, static_cast<i32>(width) * static_cast<i32>(height) * texture->getBPP() / 8);
		texture->isCompressed() ?
        glCompressedTexImage2D(face, mip, texture->getFormat(), width, height, 0, size, data) :
        glTexImage2D(face, mip, texture->getFormat(), width, height, 0, texture->getFormat(), GL_UNSIGNED_BYTE, data);
		data += size;
		width >>= 1; height >>= 1;
	}
    
    if(m_xpositive->isCommited() && m_xpositive->isLoaded() &&
       m_xnegative->isCommited() && m_xnegative->isLoaded() &&
       m_ypositive->isCommited() && m_ypositive->isLoaded() &&
       m_ynegative->isCommited() && m_ynegative->isLoaded() &&
       m_zpositive->isCommited() && m_zpositive->isLoaded() &&
       m_znegative->isCommited() && m_znegative->isLoaded())
    {
        m_status |= E_RESOURCE_STATUS_LOADED;
        m_status |= E_RESOURCE_STATUS_COMMITED;
    }
}
Exemplo n.º 2
0
// =========
void Tape::set_max_symbol_size_ ()
{
vector<symbol_t>	tmp_full_alphabet = get_full_alphabet();
  assert (max_symbol_size_ == 0);
  for (size_t i = 0; i < tmp_full_alphabet.size(); i++)
  {
    max_symbol_size_ = MAX_VALUE (max_symbol_size_, tmp_full_alphabet[i].size()); 
  }
}
Exemplo n.º 3
0
WarmCallInfo* WarmCallInfo::always_cold() {
  if (_always_cold == NULL) {
    static double bits[sizeof(WarmCallInfo) / sizeof(double) + 1] = {0};
    WarmCallInfo* ci = (WarmCallInfo*) bits;
    ci->_profit = ci->_count = MIN_VALUE();
    ci->_work   = ci->_size  = MAX_VALUE();
    _always_cold = ci;
  }
  assert(_always_cold->is_cold(), "must always be cold");
  return _always_cold;
}
Exemplo n.º 4
0
// =========
void Tape::show_alphabet (const string& msg_i) const
{
  IF_NOT_EMPTY (msg_i, 3, '=');

string text_empty_symbols_alphabet ("Empty symbols alphabet");
string text_input_alphabet ("Input alphabet");
string text_internal_alphabet ("Internal alphabet");
size_t text_max_size = 0;

  text_max_size	= MAX_VALUE(text_max_size, text_empty_symbols_alphabet.size());
  text_max_size	= MAX_VALUE(text_max_size, text_input_alphabet.size());
  text_max_size	= MAX_VALUE(text_max_size, text_internal_alphabet.size());


  cout << setw(text_max_size) << left << text_empty_symbols_alphabet.c_str() << " : ";
  for (size_t i = 0; i < empty_symbols_alphabet_.size(); i++)
  {
    cout << setw (max_symbol_size_) << empty_symbols_alphabet_[i].c_str() << " ";
  }
  cout << endl;

  cout << setw(text_max_size) << left << text_input_alphabet.c_str() << " : ";
  for (size_t i = 0; i < input_alphabet_.size(); i++)
  {
    cout << setw (max_symbol_size_) << input_alphabet_[i].c_str() << " ";
  }
  cout << endl;

  cout << setw(text_max_size) << left << text_internal_alphabet.c_str() << " : ";
  for (size_t i = 0; i < internal_alphabet_.size(); i++)
  {
    cout << setw (max_symbol_size_) << internal_alphabet_[i].c_str() << " ";
  }
  cout << endl;


}