travking fluid particle
This commit is contained in:
parent
8a5de47da3
commit
54bda855e5
10 changed files with 702 additions and 37 deletions
Client
|
@ -103,6 +103,53 @@ class Client:
|
|||
self.world_provider.world.put_object(x_pos, y_pos, z_pos, Cuboid().setColor(
|
||||
random.randint(0, 100) / 100.0, random.randint(0, 100) / 100.0, random.randint(0, 100) / 100.0))
|
||||
|
||||
colors = {}
|
||||
for plate in range(int(np.max(self.world_provider.world.plates))):
|
||||
colors[plate + 1] = (random.randint(0, 100) / 100.0,
|
||||
random.randint(0, 100) / 100.0,
|
||||
random.randint(0, 100) / 100.0)
|
||||
|
||||
for x_pos in range(0, 100):
|
||||
for y_pos in range(0, 100):
|
||||
for z_pos in range(0, 1):
|
||||
if self.world_provider.world.plates[x_pos, y_pos] == -1:
|
||||
r, g, b, = 0, 0, 1 #0.5, 0.5, 0.5
|
||||
else:
|
||||
r, g, b = colors[int(self.world_provider.world.plates[x_pos, y_pos])]
|
||||
self.world_provider.world.set_color(x_pos, y_pos, z_pos, r, g, b)
|
||||
|
||||
total_x = self.world_provider.world.chunk_n_x * self.world_provider.world.chunk_size_x
|
||||
total_y = self.world_provider.world.chunk_n_y * self.world_provider.world.chunk_size_y
|
||||
for x_pos in range(0, 100):
|
||||
for y_pos in range(0, 100):
|
||||
if self.world_provider.world.faults[x_pos, y_pos] == -2:
|
||||
self.world_provider.world.set_color(x_pos, y_pos, 0, 0, 0, 0)
|
||||
|
||||
for line_index, line in enumerate(self.world_provider.world.fault_lines):
|
||||
for x_pos in range(0, 100):
|
||||
for y_pos in range(0, 100):
|
||||
if self.world_provider.world.faults[x_pos, y_pos] == line_index:
|
||||
if line_index != 9:
|
||||
self.world_provider.world.set_color(x_pos, y_pos, 0, 0, 0, 1)
|
||||
else:
|
||||
self.world_provider.world.set_color(x_pos, y_pos, 0, 1, 1, 1)
|
||||
|
||||
for x_pos in range(0, 100):
|
||||
for y_pos in range(0, 100):
|
||||
for z_pos in range(0, 1):
|
||||
if [x_pos, y_pos] in self.world_provider.world.fault_nodes:
|
||||
r, g, b = 1, 0, 0
|
||||
self.world_provider.world.set_color(x_pos, y_pos, z_pos, r, g, b)
|
||||
|
||||
# # visualize direction lengths
|
||||
# lengths = np.sqrt(np.sum(np.square(self.world_provider.world.directions), axis=2))
|
||||
# lengths = lengths / np.max(lengths)
|
||||
# for x_pos in range(0, 100):
|
||||
# for y_pos in range(0, 100):
|
||||
# for z_pos in range(0, 1):
|
||||
# r, g, b = lengths[x_pos, y_pos], lengths[x_pos, y_pos], lengths[x_pos, y_pos]
|
||||
# self.world_provider.world.set_color(x_pos, y_pos, z_pos, r, g, b)
|
||||
|
||||
self.projMatrix = perspectiveMatrix(45.0, 400 / 400, 0.01, MAX_DISTANCE)
|
||||
|
||||
self.rx = self.cx = self.cy = 0
|
||||
|
@ -222,28 +269,31 @@ class Client:
|
|||
max_value_vel = np.max(vel)
|
||||
# max_value_vel = np.sqrt(3)
|
||||
|
||||
print('round')
|
||||
print('sum n: %f' % np.sum(self.n))
|
||||
print('max n: %f' % np.max(self.n))
|
||||
print('min n: %f' % np.min(self.n))
|
||||
print('sum vel: %f' % np.sum(vel))
|
||||
print('max vel: %f' % np.max(vel))
|
||||
print('min vel: %f' % np.min(vel))
|
||||
# print('round')
|
||||
# print('sum n: %f' % np.sum(self.n))
|
||||
# print('max n: %f' % np.max(self.n))
|
||||
# print('min n: %f' % np.min(self.n))
|
||||
# print('sum vel: %f' % np.sum(vel))
|
||||
# print('max vel: %f' % np.max(vel))
|
||||
# print('min vel: %f' % np.min(vel))
|
||||
|
||||
for x_pos in range(0, 100):
|
||||
for y_pos in range(0, 100):
|
||||
for z_pos in range(0, 1):
|
||||
if self.state == 2:
|
||||
r, g, b = value_to_color(int(self.gravity_applies[x_pos, y_pos, z_pos]), 0, 1)
|
||||
if self.state == 1:
|
||||
r, g, b = value_to_color(vel[x_pos, y_pos, z_pos], min_value, max_value_vel)
|
||||
if self.state == 0:
|
||||
r, g, b = value_to_color(self.n[x_pos, y_pos, z_pos], min_value, max_value_n)
|
||||
|
||||
self.world_provider.world.set_color(x_pos, y_pos, z_pos, r, g, b)
|
||||
self.world_provider.world.set_color(int(round(self.test_pixel[0])),
|
||||
int(round(self.test_pixel[1])),
|
||||
int(round(self.test_pixel[2])), 1.0, 1.0, 1.0)
|
||||
# for x_pos in range(0, 100):
|
||||
# for y_pos in range(0, 100):
|
||||
# for z_pos in range(0, 1):
|
||||
# # if self.state == 2:
|
||||
# # r, g, b = value_to_color(int(self.gravity_applies[x_pos, y_pos, z_pos]), 0, 1)
|
||||
# # if self.state == 1:
|
||||
# # r, g, b = value_to_color(vel[x_pos, y_pos, z_pos], min_value, max_value_vel)
|
||||
# # if self.state == 0:
|
||||
# # r, g, b = value_to_color(self.n[x_pos, y_pos, z_pos], min_value, max_value_n)
|
||||
# r, g, b, = 128, 128, 128
|
||||
# if [x_pos, y_pos] in self.world_provider.world.fault_nodes:
|
||||
# r, g, b = 128, 0, 0
|
||||
#
|
||||
# self.world_provider.world.set_color(x_pos, y_pos, z_pos, r, g, b)
|
||||
# self.world_provider.world.set_color(int(round(self.test_pixel[0])),
|
||||
# int(round(self.test_pixel[1])),
|
||||
# int(round(self.test_pixel[2])), 1.0, 1.0, 1.0)
|
||||
|
||||
# print(1.0 / (time.time() - self.time))
|
||||
self.time = time.time()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue