Skip to content
Permalink
Browse files
added example and Readme
  • Loading branch information
Daniel Bisig committed Jul 20, 2022
1 parent 81210e1 commit 83cc2c6d7dedc6431850d44f183a59a5162755dd
Show file tree
Hide file tree
Showing 14 changed files with 732 additions and 28 deletions.
@@ -1,45 +1,58 @@
**Edit a file, create a new file, and clone from Bitbucket in under 2 minutes**
## ofxDabFlock

When you're done, you can delete the content in this README and update the file with details for others getting started with your repository.
**Author**: Daniel Bisig - Coventry University, UK - [ad5041@coventry.ac.uk](ad5041@coventry.ac.uk) - Zurich University of the Arts, CH - [daniel.bisig@zhdk.ch](daniel.bisig@zhdk.ch)

*We recommend that you open this README in another tab as you perform the tasks below. You can [watch our video](https://youtu.be/0ocf7u76WSo) for a full demo of all the steps in this tutorial. Open the video in a new tab to avoid leaving Bitbucket.*
**Dependencies**: [ofxDabBase](https://bitbucket.org/dbisig/ofxdabbase_011/src/master/), [ofxDabEvent](https://bitbucket.org/dbisig/ofxdabevent_011/src/master/), [ofxDabMath](https://bitbucket.org/dbisig/ofxdabmath_011/src/master/), [ofxDabGeom](https://bitbucket.org/dbisig/ofxdabgeom_011/src/master/), [ofxDabOsc](https://bitbucket.org/dbisig/ofxdabosc_011/src/master/), [ofxDabSpace](https://bitbucket.org/dbisig/ofxdabspace_011/src/master/), [ofxAssimpModelLoader](https://openframeworks.cc/documentation/ofxAssimpModelLoader/ofxAssimpModelLoader/), [ofxJSON](https://github.com/jeffcrouse/ofxJSON)

---

## Edit a file
## Summary

You’ll start by editing this README file to learn how to edit a file in Bitbucket.
ofxDabFlock is a framework that supports the creation of flocking simulations. ofxDabFlock is highly generic in it that it doesn't impose any restrictions on the number, type and dimensionality of parameters that agents can possess. ofxDabFlock provides functions to calculate spatial relationships among parameters as well as between parameters and other spatial structures such as splines or vector-fields. Agent behaviours establish functional relationships among these parameters. ofxDabFlock can communicate via OSC messages with other applications. OSC messages can be used by other applications to receive the values of simulation parameters. In addition, OSC messages can also be employed as commands to remotely configure and control the simulation. Finally, ofxDabFlock provides simple rendering functionality to visualise the simulation. The code is compatible with OpenFrameworks 0.11 and has been tested on Windows and MacOS.

1. Click **Source** on the left side.
2. Click the README.md link from the list of files.
3. Click the **Edit** button.
4. Delete the following text: *Delete this line to make a change to the README from Bitbucket.*
5. After making your change, click **Commit** and then **Commit** again in the dialog. The commit page will open and you’ll see the change you just made.
6. Go back to the **Source** page.
### Entities

---
**Agent**: an agent is a single autonomous entity that is typically part of a larger group. And agent possesses properties and behaviours.

## Create a file
**Swarm**: a swarm is a collection of agents that typically identical the same properties and behaviours. Agents can be removed or added from a swarm. The swarm can also possess its own properties and behaviours that are independent of those of the agents.

Next, you’ll add a new file to this repository.
**Env**: an environment is a space that is discretised as a grid with each grid. An environment can possess its own properties and behaviours. Its properties can possess different values at each grid location.

1. Click the **New file** button at the top of the **Source** page.
2. Give the file a filename of **contributors.txt**.
3. Enter your name in the empty file space.
4. Click **Commit** and then **Commit** again in the dialog.
5. Go back to the **Source** page.
### Properties

Before you move on, go ahead and explore the repository. You've already seen the **Source** page, but check out the **Commits**, **Branches**, and **Settings** pages.
**Parameter**: represents a named property of an agent or swarm and stores an array of floating point values. Neighbourhood relationships are based on the Euclidian distance between parameters.

---
**EnvParameter**: represents a named property of an environment. Stores the values of the parameter at each cell position for a spatial grid.

**ParameterList**: a collection of all parameters of an agent, swarm, or environment.

### Behaviours

**Behavior**: represents a named behaviour of an agent or swarm. Behaviours operate on input and output parameters, and overwrites the values of the latter based on the values of the former. Depending on the behaviour, neighbourhood relationships between parameters are taken into account or not.

**EnvBehavior**: represents a named behaviour of an environment.

**BehaviorList**: a collection of all behaviours of an agent, swarm, or environment.

### Communication

**FlockCom**: manages all communication with a flocking simulation. Allows to register parameters whose values are then sent via OSC to a listening port.

**OscControl**: handles the remote control of a flocking simulation via OSC messages.

### Serialisation

**SerializeTools**: The configuration and state of a flocking simulation can be saved as JSON files and later on restored from these files.

### Visualisation

**FlockVisuals**: provides simple functionality for visualisation the flocking simulation.

**VisAgentShape**: draws agents as geometrical object

## Clone a repository
**VisAgentTrail**: draws the trajectory of an agent parameter as polyline

Use these steps to clone from SourceTree, our client for using the repository command-line free. Cloning allows you to work on your files locally. If you don't yet have SourceTree, [download and install first](https://www.sourcetreeapp.com/). If you prefer to clone from the command line, see [Clone a repository](https://confluence.atlassian.com/x/4whODQ).
**VisNeighborSpace**: draws neigbourhood relationships between parameters as lines

1. You’ll see the clone button under the **Source** heading. Click that button.
2. Now click **Check out in SourceTree**. You may need to create a SourceTree account or log in.
3. When you see the **Clone New** dialog in SourceTree, update the destination path and name if you’d like to and then click **Clone**.
4. Open the directory you just created to see your repository’s files.
**VisGridSpace**: draws the values at the grid positions of an environment grid as lines

Now that you're more familiar with your Bitbucket repository, go ahead and add a new file locally. You can [push your change back to Bitbucket with SourceTree](https://confluence.atlassian.com/x/iqyBMg), or you can [add, commit,](https://confluence.atlassian.com/x/8QhODQ) and [push from the command line](https://confluence.atlassian.com/x/NQ0zDQ).
@@ -0,0 +1,9 @@
ofxAssimpModelLoader
ofxDabBase
ofxDabEvent
ofxDabMath
ofxDabGeom
ofxDabOsc
ofxDabSpace
ofxJSON
ofxDabFlock
@@ -0,0 +1,9 @@
#version 330

uniform vec4 Color;
out vec4 outputColor;

void main()
{
outputColor = Color;
}
@@ -0,0 +1,15 @@
#version 330

// these are for the programmable pipeline system and are passed in
// by default from OpenFrameworks
layout(location = 0) in vec4 vertexPosition_ModelSpace;

uniform vec4 Color;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;

void main()
{
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vertexPosition_ModelSpace;
}
@@ -0,0 +1,9 @@
#version 330

uniform vec4 Color;
out vec4 outputColor;

void main()
{
outputColor = Color;
}
@@ -0,0 +1,15 @@
#version 330

// these are for the programmable pipeline system and are passed in
// by default from OpenFrameworks
layout(location = 0) in vec4 vertexPosition_ModelSpace;

uniform vec4 Color;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;

void main()
{
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vertexPosition_ModelSpace;
}
@@ -0,0 +1,9 @@
#version 330

uniform vec4 Color;
out vec4 outputColor;

void main()
{
outputColor = Color;
}
@@ -0,0 +1,15 @@
#version 330

// these are for the programmable pipeline system and are passed in
// by default from OpenFrameworks
layout(location = 0) in vec4 vertexPosition_ModelSpace;

uniform vec4 Color;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;

void main()
{
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vertexPosition_ModelSpace;
}
@@ -0,0 +1,11 @@
#version 330

in float v_alpha;
uniform vec4 Color;
out vec4 outputColor;

void main()
{
outputColor = Color;
outputColor.a *= v_alpha;
}
@@ -0,0 +1,18 @@
#version 330

// these are for the programmable pipeline system and are passed in
// by default from OpenFrameworks
layout(location = 0) in vec4 vertexPosition_ModelSpace;
layout (location = 1) in float alpha;
out float v_alpha;

uniform vec4 Color;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;

void main()
{
v_alpha = alpha;
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vertexPosition_ModelSpace;
}
@@ -0,0 +1,140 @@
################################################################################
# CONFIGURE PROJECT MAKEFILE (optional)
# This file is where we make project specific configurations.
################################################################################

################################################################################
# OF ROOT
# The location of your root openFrameworks installation
# (default) OF_ROOT = ../../..
################################################################################
OF_ROOT = C:\Users\dbisig\Programming\of_v0.11.2

################################################################################
# PROJECT ROOT
# The location of the project - a starting place for searching for files
# (default) PROJECT_ROOT = . (this directory)
#
################################################################################
# PROJECT_ROOT = .

################################################################################
# PROJECT SPECIFIC CHECKS
# This is a project defined section to create internal makefile flags to
# conditionally enable or disable the addition of various features within
# this makefile. For instance, if you want to make changes based on whether
# GTK is installed, one might test that here and create a variable to check.
################################################################################
# None

################################################################################
# PROJECT EXTERNAL SOURCE PATHS
# These are fully qualified paths that are not within the PROJECT_ROOT folder.
# Like source folders in the PROJECT_ROOT, these paths are subject to
# exlclusion via the PROJECT_EXLCUSIONS list.
#
# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
#
# Note: Leave a leading space when adding list items with the += operator
################################################################################
# PROJECT_EXTERNAL_SOURCE_PATHS =

################################################################################
# PROJECT EXCLUSIONS
# These makefiles assume that all folders in your current project directory
# and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
# to look for source code. The any folders or files that match any of the
# items in the PROJECT_EXCLUSIONS list below will be ignored.
#
# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
# string unless teh user adds a wildcard (%) operator to match subdirectories.
# GNU make only allows one wildcard for matching. The second wildcard (%) is
# treated literally.
#
# (default) PROJECT_EXCLUSIONS = (blank)
#
# Will automatically exclude the following:
#
# $(PROJECT_ROOT)/bin%
# $(PROJECT_ROOT)/obj%
# $(PROJECT_ROOT)/%.xcodeproj
#
# Note: Leave a leading space when adding list items with the += operator
################################################################################
# PROJECT_EXCLUSIONS =

################################################################################
# PROJECT LINKER FLAGS
# These flags will be sent to the linker when compiling the executable.
#
# (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs
#
# Note: Leave a leading space when adding list items with the += operator
#
# Currently, shared libraries that are needed are copied to the
# $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
# add a runtime path to search for those shared libraries, since they aren't
# incorporated directly into the final executable application binary.
################################################################################
# PROJECT_LDFLAGS=-Wl,-rpath=./libs
################################################################################
# PROJECT DEFINES
# Create a space-delimited list of DEFINES. The list will be converted into
# CFLAGS with the "-D" flag later in the makefile.
#
# (default) PROJECT_DEFINES = (blank)
#
# Note: Leave a leading space when adding list items with the += operator
################################################################################
# PROJECT_DEFINES =

################################################################################
# PROJECT CFLAGS
# This is a list of fully qualified CFLAGS required when compiling for this
# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
# defined in your platform specific core configuration files. These flags are
# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
#
# (default) PROJECT_CFLAGS = (blank)
#
# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
# your platform specific configuration file will be applied by default and
# further flags here may not be needed.
#
# Note: Leave a leading space when adding list items with the += operator
################################################################################
# PROJECT_CFLAGS =

################################################################################
# PROJECT OPTIMIZATION CFLAGS
# These are lists of CFLAGS that are target-specific. While any flags could
# be conditionally added, they are usually limited to optimization flags.
# These flags are added BEFORE the PROJECT_CFLAGS.
#
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
#
# (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank)
#
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets.
#
# (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
#
# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
# file will be applied by default and further optimization flags here may not
# be needed.
#
# Note: Leave a leading space when adding list items with the += operator
################################################################################
# PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
# PROJECT_OPTIMIZATION_CFLAGS_DEBUG =

################################################################################
# PROJECT COMPILERS
# Custom compilers can be set for CC and CXX
# (default) PROJECT_CXX = (blank)
# (default) PROJECT_CC = (blank)
# Note: Leave a leading space when adding list items with the += operator
################################################################################
# PROJECT_CXX =
# PROJECT_CC =
@@ -0,0 +1,16 @@
#include "ofMain.h"
#include "ofApp.h"

//========================================================================
int main()
{
ofGLWindowSettings settings;
settings.setGLVersion(3, 2);
ofCreateWindow(settings);

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());

}

0 comments on commit 83cc2c6

Please sign in to comment.