reconnecting particle cloud

This commit is contained in:
Philip Rosedale 2013-10-08 22:21:55 -07:00
parent 69277ec8ba
commit ce2e31ddd5
7 changed files with 27 additions and 14 deletions

View file

@ -1972,6 +1972,9 @@ void Application::update(float deltaTime) {
_myAvatar.simulate(deltaTime, NULL);
}
// Simulate particle cloud movements
_cloud.simulate(deltaTime);
// no transmitter drive implies transmitter pick
if (!Menu::getInstance()->isOptionChecked(MenuOption::TransmitterDrive) && _myTransmitter.isConnected()) {
_transmitterPickStart = _myAvatar.getSkeleton().joint[AVATAR_JOINT_CHEST].position;
@ -2489,7 +2492,10 @@ void Application::displaySide(Camera& whichCamera) {
glDisable(GL_NORMALIZE);
//renderGroundPlaneGrid(EDGE_SIZE_GROUND_PLANE, _audio.getCollisionSoundMagnitude());
}
}
// Draw Cloud Particles
_cloud.render();
// Draw voxels
if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
@ -2499,6 +2505,7 @@ void Application::displaySide(Camera& whichCamera) {
}
}
// restore default, white specular
glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR);

View file

@ -29,6 +29,7 @@
#include "BandwidthMeter.h"
#include "Camera.h"
#include "Cloud.h"
#include "Environment.h"
#include "GLCanvas.h"
#include "PacketHeaders.h"
@ -261,6 +262,8 @@ private:
Stars _stars;
Cloud _cloud;
VoxelSystem _voxels;
VoxelTree _clipboard; // if I copy/paste
VoxelImporter _voxelImporter;

View file

@ -10,17 +10,19 @@
#include <InterfaceConfig.h>
#include "Cloud.h"
#include "Util.h"
#include "Field.h"
#define COLOR_MIN 0.2f // minimum R/G/B value at 0,0,0 - also needs setting in field.cpp
Cloud::Cloud(int num,
glm::vec3 box,
int wrap) {
const int NUM_PARTICLES = 20000;
#define COLOR_MIN 0.2f
Cloud::Cloud() {
// Create and initialize particles
unsigned int i;
bounds = box;
count = num;
wrapBounds = wrap != 0;
glm::vec3 box = glm::vec3(WORLD_SIZE);
count = NUM_PARTICLES;
wrapBounds = false;
particles = new Particle[count];
field = new Field();
@ -80,6 +82,7 @@ void Cloud::render() {
void Cloud::simulate (float deltaTime) {
unsigned int i;
field->simulate(deltaTime);
for (i = 0; i < count; ++i) {
// Update position

View file

@ -13,9 +13,7 @@
class Cloud {
public:
Cloud(int num,
glm::vec3 box,
int wrap);
Cloud();
void simulate(float deltaTime);
void render();

View file

@ -15,6 +15,8 @@
#define USE_SCALAR 0
#define WORLD_SIZE 100.0
// A vector-valued field over an array of elements arranged as a 3D lattice
int Field::value(float *value, float *pos)

View file

@ -15,6 +15,8 @@
#include "world.h"
#include "Util.h"
#define WORLD_SIZE 100.0
// Field is a lattice of vectors uniformly distributed FIELD_ELEMENTS^(1/3) on side
const int FIELD_ELEMENTS = 1000;

View file

@ -4,9 +4,7 @@
//
// Created by Philip Rosedale on 8/23/12.
// Copyright (c) 2012 High Fidelity, Inc. All rights reserved.
//
// Simulation happens in positive cube with edge of size WORLD_SIZE
//
#ifndef __interface__world__
#define __interface__world__