Esempio n. 1
0
	BlockInfo Chunk::GetBlock(int x, int y, int z)
	{
		BlockInfo* ptr = this->get(x, y, z);
		if (ptr)
		{
			return *ptr;
		}
		else
			return BlockInfo();
	}
Esempio n. 2
0
	void renderChunk(world::chunk* c) {
		int x, y, z;
		renderer::Init(2, 3);
		for (x = 0; x < 16; x++) {
			for (y = 0; y < 16; y++) {
				for (z = 0; z < 16; z++) {
					block curr = c->getblock(x, y, z);
					if (curr == blocks::AIR) continue;
					if (!BlockInfo(curr).isTranslucent()) renderblock(x, y, z, c);
				}
			}
		}
		renderer::Flush(c->vbuffer[0], c->vertexes[0]);
		renderer::Init(2, 3);
		for (x = 0; x < 16; x++) {
			for (y = 0; y < 16; y++) {
				for (z = 0; z < 16; z++) {
					block curr = c->getblock(x, y, z);
					if (curr == blocks::AIR) continue;
					if (BlockInfo(curr).isTranslucent() && BlockInfo(curr).isSolid()) renderblock(x, y, z, c);
				}
			}
		}
		renderer::Flush(c->vbuffer[1], c->vertexes[1]);
		renderer::Init(2, 3);
		for (x = 0; x < 16; x++) {
			for (y = 0; y < 16; y++) {
				for (z = 0; z < 16; z++) {
					block curr = c->getblock(x, y, z);
					if (curr == blocks::AIR) continue;
					if (!BlockInfo(curr).isSolid()) renderblock(x, y, z, c);
				}
			}
		}
		renderer::Flush(c->vbuffer[2], c->vertexes[2]);
	}
Esempio n. 3
0
	return input == NULL ? false : true;
}
bool Use_LCG(_RNG_Parameters_){
	LC_RNG rng(seed);
	rng.GenerateBlock(input,size);
	return input == NULL ? false : true;
}

/************************库信息说明*****************************/
//其他数值分别是BLOCK,STREAM,HASH,MAC,RNG
extern const int DLL_ALGORITHM_TYPE = 0;
/************************算法信息*****************************/
//数组AMOUNT中第一个数为分组密码算法的数量,以后依次为流密码,HASH,MAC,RNG的数量
extern const int AMOUNTS[] = {21,6,18,6,2};
extern const Cipher CIPHERS[] = {
	BlockInfo("AES",KL(AES),BS(AES)),BlockInfo("Blowfish",KL(Blowfish),BS(Blowfish)),
	BlockInfo("Camellia",KL(Camellia),BS(Camellia)),BlockInfo("CAST256",KL(CAST256),BS(CAST256)),
	BlockInfo("DES",KL(DES),BS(DES)),BlockInfo("MARS",KL(MARS),BS(MARS)),
	BlockInfo("IDEA",KL(IDEA),BS(IDEA)),BlockInfo("RC5",KL(RC5),BS(RC5)),
	BlockInfo("RC6",KL(RC6),BS(RC6)),BlockInfo("SEED",KL(SEED),BS(SEED)),
	BlockInfo("Serpent",KL(Serpent),BS(Serpent)),BlockInfo("SHACAL2",KL(SHACAL2),BS(SHACAL2)),
	BlockInfo("SKIPJACK",KL(SKIPJACK),BS(SKIPJACK)),BlockInfo("TEA",KL(TEA),BS(TEA)),
	BlockInfo("Twofish",KL(Twofish),BS(Twofish)),BlockInfo("XTEA",KL(XTEA),BS(XTEA)),
	BlockInfo("DES_EDE3",KL(DES_EDE3),BS(DES_EDE3)),BlockInfo("GOST",KL(GOST),BS(GOST)),
	BlockInfo("SHARK",KL(SHARK),BS(SHARK)),BlockInfo("Square",KL(Square),BS(Square)),
	BlockInfo("ThreeWay",KL(ThreeWay),BS(ThreeWay)),

	StreamInfo("Sosemanuk",KL(Sosemanuk),IL(Sosemanuk)),
	StreamInfo("Salsa20",KL(Salsa20),IL(Salsa20)),
	StreamInfo("XSalsa20",KL(XSalsa20),IL(XSalsa20)),
	StreamInfo("SEAL",KL(SEAL<>),IL(SEAL<>)),
Esempio n. 4
0
void badBlock(bytesConstRef _block, string const& _err)
{
    BlockInfo bi;
    DEV_IGNORE_EXCEPTIONS(bi = BlockInfo(_block, CheckNothing));
    badBlockInfo(bi, _err);
}
Esempio n. 5
0
	void chunk::buildlists(){
		if (isEmptyChunk) return;
		//建立chunk显示列表
		int x, y, z;
		for (x = -1; x != 2; x++) {
			for (y = -1; y != 2; y++) {
				for (z = -1; z != 2; z++) {
					if (x == 0 && y == 0 && z == 0) continue;
					if (chunkOutOfBound(cx + x, cy + y, cz + z))  continue;
					if (!chunkLoaded(cx + x, cy + y, cz + z)) return;
				}
			}
		}
                
		rebuiltChunks++;
		updatedChunks++;
		if (!isBuilt) {
			isBuilt = true;
			loadAnim = cy * 16 + 16;
			glGenBuffersARB(3, vbuffer);
		}

		renderer::Init();
		glBindTexture(GL_TEXTURE_2D, BlockTextures);
		for (x = 0; x != 16; x++) {
			for (y = 0; y != 16; y++) {
				for (z = 0; z != 16; z++) {
					if (pblocks[x][y][z] == blocks::AIR) continue;
					if (!BlockInfo(pblocks[x][y][z]).isTranslucent())
						renderblock(x, y, z, this);
				}
			}
		}
		renderer::Flush(vbuffer[0], vertexes[0]);
		
		renderer::Init();
		glBindTexture(GL_TEXTURE_2D, BlockTextures);
		for (x = 0; x != 16; x++){
			for (y = 0; y != 16; y++){
				for (z = 0; z != 16; z++){
					if (pblocks[x][y][z] == blocks::AIR) continue;
					if (BlockInfo(pblocks[x][y][z]).isTranslucent() && BlockInfo(pblocks[x][y][z]).isSolid())
						renderblock(x, y, z, this);
				}
			}
		}
		renderer::Flush(vbuffer[1], vertexes[1]);

		renderer::Init();
		glBindTexture(GL_TEXTURE_2D, BlockTextures);
		for (x = 0; x != 16; x++){
			for (y = 0; y != 16; y++){
				for (z = 0; z != 16; z++){
					if (pblocks[x][y][z] == blocks::AIR) continue;
					if (!BlockInfo(pblocks[x][y][z]).isSolid())
						renderblock(x, y, z, this);
				}
			}
		}
		renderer::Flush(vbuffer[2], vertexes[2]);
		updated = false;

	}
Esempio n. 6
0
	void mergeFaceRender(world::chunk* c) {
		int cx = c->cx, cy = c->cy, cz = c->cz;
		int x = 0, y = 0, z = 0;
		QuadPrimitive cur;
		int cur_l_mx;
		block bl, neighbour;
		brightness br;
		bool valid = false;
		for (int steps = 0; steps < 3; steps++) {
			cur = QuadPrimitive();
			cur_l_mx = bl = neighbour = br = 0;
			//Linear merge
			renderer::Init(3, 3);
			for (int d = 0; d < 6; d++){
				cur.direction = d;
				for (int i = 0; i < 16; i++) for (int j = 0; j < 16; j++) {
					for (int k = 0; k < 16; k++) {
						//Get position
						if (d < 2) x = i, y = j, z = k;
						else if (d < 4) x = i, y = j, z = k;
						else x = k, y = i, z = j;
						//Get properties
						bl = c->getblock(x, y, z);
						//Get neighbour properties
						int xx = x + delta[d][0], yy = y + delta[d][1], zz = z + delta[d][2];
						int gx = cx * 16 + xx, gy = cy * 16 + yy, gz = cz * 16 + zz;
						if (xx < 0 || xx >= 16 || yy < 0 || yy >= 16 || zz < 0 || zz >= 16) {
							neighbour = world::getblock(gx, gy, gz);
							br = world::getbrightness(gx, gy, gz);
						}
						else {
							neighbour = c->getblock(xx, yy, zz);
							br = c->getbrightness(xx, yy, zz);
						}
						//Render
						if (bl == blocks::AIR || bl == neighbour && bl != blocks::LEAF || BlockInfo(neighbour).isOpaque() ||
							steps == 0 && BlockInfo(bl).isTranslucent() ||
							steps == 1 && (!BlockInfo(bl).isTranslucent() || !BlockInfo(bl).isSolid()) ||
							steps == 2 && (!BlockInfo(bl).isTranslucent() || BlockInfo(bl).isSolid())) {
							//Not valid block
							if (valid) {
								if (BlockInfo(neighbour).isOpaque()) {
									if (cur_l_mx < cur.length) cur_l_mx = cur.length;
									cur_l_mx++;
								}
								else {
									renderPrimitive(cur);
									valid = false;
								}
							}
							continue;
						}
						if (valid) {
							if (bl != cur.block || br != cur.brightness) {
								renderPrimitive(cur);
								cur.x = x; cur.y = y; cur.z = z; cur.length = cur_l_mx = 0;
								cur.block = bl; cur.brightness = br;
							}
							else {
								if (cur_l_mx > cur.length) cur.length = cur_l_mx;
								cur.length++;
							}
						}
						else {
							valid = true;
							cur.x = x; cur.y = y; cur.z = z; cur.length = cur_l_mx = 0;
							cur.block = bl; cur.brightness = br;
						}
					}
					if (valid) {
						renderPrimitive(cur);
						valid = false;
					}
				}
			}
			renderer::Flush(c->vbuffer[steps], c->vertexes[steps]);
		}
	}
Esempio n. 7
0
	void Chunk::RemoveBlock(Coord coord)
	{
		this->SetBlock(coord.X, coord.Y, coord.Z, BlockInfo(0, 0, 0, 0));
	}
Esempio n. 8
0
	void Chunk::RemoveBlock(int x, int y, int z)
	{
		this->SetBlock(x, y, z, BlockInfo(0, 0, 0, 0));
	}
Esempio n. 9
0
/***********************************************************************
 * evaluation procedure implementation
 **********************************************************************/
bool BlockEval::evaluationProcedure(void)
{
    if (_newEnvironmentEval->isFailureState())
    {
        assert(not _newEnvironmentEval->getErrorMsg().isEmpty());
        _lastBlockStatus.blockErrorMsgs.push_back(_newEnvironmentEval->getErrorMsg());
        return false;
    }
    bool evalSuccess = true;

    //the environment changed? clear everything
    //or the block changed enabled or disabled
    if (_newEnvironment != _lastEnvironment or
        _newBlockInfo.enabled != _lastBlockInfo.enabled)
    {
        _lastEnvironmentEval = _newEnvironmentEval;
        _lastEnvironment = _newEnvironment;
        _lastBlockInfo = BlockInfo();
        _blockEval = Pothos::Proxy();
        _proxyBlock = Pothos::Proxy();
    }

    //when disabled, we only evaluate the properties
    //however there is no object to apply properties.
    if (not _newBlockInfo.enabled)
    {
        evalSuccess = this->updateAllProperties();
        goto handle_property_errors;
    }

    //special case: apply settings only
    //no critical changes, block already exists
    else if (_blockEval and not this->hasCriticalChange())
    {
        //update all properties - regardless of changes
        bool setterError = not this->updateAllProperties();
        if (not setterError) for (const auto &setter : this->settersChangedList())
        {
            try
            {
                _blockEval.callVoid("handleCall", setter);
            }
            catch (const Pothos::Exception &ex)
            {
                this->reportError(setter->getValue<std::string>("name"), ex);
                setterError = true;
                break;
            }
        }
        if (setterError) evalSuccess = false;
    }

    //otherwise, make a new block and all calls
    //update all properties - regardless of changes
    //this may create a new _blockEval if needed
    else if (this->updateAllProperties())
    {
        //widget blocks have to be evaluated in the GUI thread context, otherwise, eval here
        if (_newBlockInfo.isGraphWidget)
        {
            QMetaObject::invokeMethod(this, "blockEvalInGUIContext", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, evalSuccess));
        }
        else try
        {
Esempio n. 10
0
eth::BlockInfo MixClient::blockInfo() const
{
	ReadGuard l(x_state);
	return BlockInfo(bc().block());
}
Esempio n. 11
0
	void chunk::buildRender(){
		if (Empty) return;
#ifdef NEWORLD_DEBUG_CONSOLE_OUTPUT
		if (pblocks == nullptr || pbrightness == nullptr){
			DebugWarning("Empty pointer when building vertex buffers!");
			return;
		}
#endif
		//建立chunk显示列表
		int x, y, z;
		for (x = -1; x <= 1; x++) {
			for (y = -1; y <= 1; y++) {
				for (z = -1; z <= 1; z++) {
					if (x == 0 && y == 0 && z == 0) continue;
					if (chunkOutOfBound(cx + x, cy + y, cz + z))  continue;
					if (!chunkLoaded(cx + x, cy + y, cz + z)) return;
				}
			}
		}
		
		rebuiltChunks++;
		updatedChunks++;

		if (renderBuilt == false){
			renderBuilt = true;
			loadAnim = cy * 16.0f + 16.0f;
		}

		renderer::Init();
		for (x = 0; x < 16; x++) {
			for (y = 0; y < 16; y++) {
				for (z = 0; z < 16; z++) {
					if (pblocks[x*256 + y*16 + z] == blocks::AIR) continue;
					if (!BlockInfo(pblocks[x*256 + y*16 + z]).isTranslucent())
						renderblock(x, y, z, this);
				}
			}
		}
		renderer::Flush(vbuffer[0], vertexes[0]);
		
		renderer::Init();
		for (x = 0; x < 16; x++){
			for (y = 0; y < 16; y++){
				for (z = 0; z < 16; z++){
					if (pblocks[x*256 + y*16 + z] == blocks::AIR) continue;
					if (BlockInfo(pblocks[x*256 + y*16 + z]).isTranslucent() && BlockInfo(pblocks[x*256 + y*16 + z]).isSolid())
						renderblock(x, y, z, this);
				}
			}
		}
		renderer::Flush(vbuffer[1], vertexes[1]);

		renderer::Init();
		for (x = 0; x < 16; x++){
			for (y = 0; y < 16; y++){
				for (z = 0; z < 16; z++){
					if (pblocks[x*256 + y*16 + z] == blocks::AIR) continue;
					if (!BlockInfo(pblocks[x*256 + y*16 + z]).isSolid())
						renderblock(x, y, z, this);
				}
			}
		}
		renderer::Flush(vbuffer[2], vertexes[2]);
		updated = false;

	}