void ShaderDependencyTask::operator()()
{
  SharedResourcePtr resourcePtr = mResource.lock();
  if (!resourcePtr) {
    finish(false);
    return;
  }

  resourcePtr->parsed(true);

  finish(true);
}
void ShaderDependencyTask::run()
{
  SharedResourcePtr resourcePtr = mResource.lock();
  if (!resourcePtr) {
    signalCompletion(false);
    return;
  }

  resourcePtr->parsed(true);

  signalCompletion();
}
Exemplo n.º 3
0
void MeshDependencyTask::operator()()
{
  SharedResourcePtr resourcePtr = mResource.lock();
  if (!resourcePtr) {
    finish(false);
    return;
  }

  if (OPTION_ENABLE_TEXTURES->as<bool>()) {
    GraphicsResourceManager *grm = GraphicsResourceManager::getSingletonPtr();

    MemoryBuffer::iterator itr, iend;
    for (itr = mBuffer.begin(), iend = mBuffer.end() - 7; itr != iend; ++itr) {
      if (*itr == 'm'
       && (*(itr + 1)) == 'e'
       && (*(itr + 2)) == 'r'
       && (*(itr + 3)) == 'u'
       && (*(itr + 4)) == ':'
       && (*(itr + 5)) == '/'
       && (*(itr + 6)) == '/') {
        String matDep = "";

        while (itr != iend + 4) {
          if (*itr == '.' && (*(itr + 1) == 'o')  && (*(itr + 2) == 's')) {
            matDep += ".os";
             break;
          }
          matDep += *itr;
          ++itr;
        }

        SharedResourcePtr hashResource = grm->getResourceAsset(URI(matDep), GraphicsResource::MATERIAL);
        resourcePtr->addDependency(hashResource);
      }
    }
  }

  resourcePtr->setCost(mBuffer.size());
  resourcePtr->parsed(true);

  finish(true);
}