//----------------------------------------------------------------------- ResourcePtr ResourceManager::prepare(const String& name, const String& group, bool isManual, ManualResourceLoader* loader, const NameValuePairList* loadParams, bool backgroundThread) { ResourcePtr r = createOrRetrieve(name,group,isManual,loader,loadParams).first; // ensure prepared r->prepare(backgroundThread); return r; }
void initializeImpl() { c.setPosition(Vector3f(0.0f, 0.0f, 150.0f)); /* float lightAmbient[] = { 0.2f, 0.3f, 0.6f, 1.0f }; float lightDiffuse[] = { 0.2f, 0.3f, 0.6f, 1.0f }; glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse); */ swmR.readFile("ViperMKVII.swm", model); const std::vector<GLfloat> &mdlVertices = model.getVerticeVec(); const std::vector<GLfloat> &mdlNormals = model.getVNormalVec(); const std::vector<GLfloat> &mdlTexCoords = model.getVTextureVec(); std::size_t totalSize, vertexSize, normalSize, texCoordSize; vertexSize = sizeof(&mdlVertices[0]) * mdlVertices.size(); normalSize = sizeof(&mdlNormals[0]) * mdlNormals.size(); texCoordSize = sizeof(&mdlTexCoords[0]) * mdlTexCoords.size(); totalSize = vertexSize + normalSize + texCoordSize; vertexBuffer = HardwareBufferPtr(new HardwareBuffer(totalSize, HardwareBuffer::STATIC_DRAW, HardwareBuffer::VERTEX)); vertexBuffer->upload(0, vertexSize, &mdlVertices[0]); vertexBuffer->upload(vertexSize, normalSize, &mdlNormals[0]); vertexBuffer->upload(vertexSize + normalSize, texCoordSize, &mdlTexCoords[0]); //indexBuffer = HardwareBufferPtr(new HardwareBuffer(sizeof(&mdlIndices[0]) * mdlIndices.size(), HardwareBuffer::STATIC_DRAW, HardwareBuffer::INDEX)); //indexBuffer->upload(&mdlIndices[0]); //rop.indexData = new IndexData(); //rop.indexData->indexBuffer = indexBuffer; //rop.indexData->count = mdlIndices.size(); //rop.indexData->start = 0; rop.indexed = false; rop.vertexData = new VertexData(); rop.vertexData->count = mdlVertices.size(); rop.vertexData->start = 0; rop.vertexData->bufferElementGroup.addElement(0,0,POSITION,FLOAT3); rop.vertexData->bufferElementGroup.addElement(0,vertexSize,NORMAL,FLOAT3); rop.vertexData->bufferElementGroup.addElement(0,vertexSize + normalSize,TEXTURE_COORDINATES,FLOAT3); rop.vertexData->bufferBinding[0] = vertexBuffer; rop.primitiveType = RenderOperation::TRIANGLES; glShadeModel(GL_SMOOTH); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); //c.move(Vector3f(0.0, 10450.0, 0.0)); //c.setPosition(Vector3f(4000.0, 10450.0, 20620.0)); //c.setDirection(Vector3f(3999.0, 10450.0, 20620.0)); //c.rotate(Vector3f::Y, static_cast<Math::Units::Radians>(270 * Math::Units::degrees)); texture = TexturePtr(new Texture(NULL, "ViperMKVII", 0, TEXTURE_2D)); texture->setFilePath("ViperMKVII.dds"); texture->prepare(); std::cout << static_cast<Texture*> (texture.get())->getID() << std::endl; texture->load(); atm.Start(); s.myinit(); }