Example #1
0
glm::vec3 player::GetOffsetToChunk() const {
	ChunkCoord cc;
	GetChunkCoord(&cc);
	unsigned short dx = (unsigned short)(this->x - cc.x*FACT);
	unsigned short dy = (unsigned short)(this->y - cc.y*FACT);
	unsigned short dz = (unsigned short)(this->z - cc.z*FACT);

	// Convert this to OpenGL coordinates
	return glm::vec3(float(dx)/BLOCK_COORD_RES, float(dz)/BLOCK_COORD_RES, -float(dy)/BLOCK_COORD_RES);
}
Example #2
0
glm::ivec3 Chunk::GetChunkPosition(float x, float y, float z) {
	return glm::ivec3(GetChunkCoord(x), GetChunkCoord(y), GetChunkCoord(z));
}