Esempio n. 1
0
		void generate(Type type, int resolution, int lodFactor_, bool leftLod, bool rightLod, bool upLod, bool downLod, unsigned char *clipBuffer)
		{
			faceAmount = 0;
			lodFactor = lodFactor_;

			int bufferSize = (resolution - 1) * (resolution - 1) * 6 * sizeof(short);
			indexBuffer.create((resolution - 1) * (resolution - 1) * 2, false);

			boost::scoped_array<unsigned short> tempBuffer(new unsigned short[bufferSize / sizeof(short)]);
			if(!tempBuffer)
				return;

			if(type == FullBuffer)
				generateCenter(tempBuffer.get(), resolution, clipBuffer);

			generateLink(tempBuffer.get(), resolution, leftLod, rightLod, upLod, downLod, clipBuffer);

			unsigned short *buffer = indexBuffer.lock();
			memcpy(buffer, tempBuffer.get(), faceAmount * sizeof(short));

			faceAmount /= 3;
			indexBuffer.unlock();
		}
Esempio n. 2
0
    void generate(IndexStorage16& storage, Type type, int resolution, int lodFactor_, bool leftLod, bool rightLod, bool upLod, bool downLod, unsigned char *clipBuffer)
    {
        faceAmount = 0;
        lodFactor = lodFactor_;

        int idxCount = (resolution - 1) * (resolution - 1) * 6;

        allocId = storage.alloc(idxCount);
        if (!allocId)
            return;

        uint16_t* indices = storage.lock(allocId);

        if (type == FullBuffer)
            generateCenter(indices, resolution, clipBuffer);

        generateLink(indices, resolution, leftLod, rightLod, upLod, downLod, clipBuffer);

        storage.unlock();

        faceAmount /= 3;
        baseIndex = storage.baseIndex(allocId);
    }