This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Shader.h" | |
using namespace std; | |
Shader::Shader() : program(0), shaders(vector<GLuint>()) | |
{ | |
// do not create program here, because it will be initialized before gl context | |
// program = glCreateProgram(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layout(location = 0) in vec4 position; | |
uniform mat4 viewportTranslation; | |
uniform mat4 projectionMatrix; | |
void main() | |
{ | |
vec4 p2; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from /Users/drakej/Projects/Spider-Fish/glfw-src/Spider-Fish/main.cpp:11: | |
/Users/drakej/Projects/Spider-Fish/glfw-src/Spider-Fish/SpiderFish.h:40:21: error: implicit instantiation of undefined template 'std::__1::array<float, 4>' [3] | |
array<float, 4> viewport; | |
^ | |
/Developer/usr/bin/../lib/c++/v1/__tuple:66:59: note: template is declared here [3] | |
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
struct tvec4 | |
{ | |
enum ctor{null}; | |
typedef T value_type; | |
typedef std::size_t size_type; | |
GLM_FUNC_DECL size_type length() const; | |
static GLM_FUNC_DECL size_type value_size(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [x, y] = graph (varargin) | |
list = varargin{1}; | |
for i = 2:length(varargin) | |
cat(1, list, varargin{i}); | |
endfor | |
x = list(1:rows(list), 1); | |
y = list(1:rows(list), 2); | |
x = cat(1, x, x(1)); | |
y = cat(1, y, y(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program particles | |
! ten particles in a field of 10000 x 10000 | |
! base velocity is 10 x 10 | |
integer, parameter :: p = 10, & | |
fx = 10000, fy = 10000, & | |
bx = 10, by = 10, & | |
steps = 10000 | |
real, parameter :: radius = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subroutine step(positions, velocities) | |
real, dimension(p,2), intent(inout) :: positions, velocities | |
! verify lengths (? unnecessary?) | |
if (size(positions, 1) .ne. size(velocities, 1)) then | |
print *, "The sizes of two arrays are not the same" | |
end if | |
! move the particles to the new position | |
do i = 1, size(positions, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function math.clamp(v, min, max) | |
if v > max then | |
return max | |
elseif v < min then | |
return min | |
else | |
return v | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("string") | |
state = {} | |
function love.load() | |
state.size = { cx = love.graphics.getWidth(), cy = love.graphics.getHeight() } | |
-- ball is a position, a mass, and a velocity | |
state.ball = { position = { x = state.size.cx / 2, y = state.size.cy / 2 }, | |
mass = 50, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float inputX[4] = { 2, 4, 8, 16 }; | |
float inputY[4] = { 2, 4, 8, 16 }; | |
float resultZ[4] = { 0, 0, 0, 0 }; | |
float32x4_t sample1, sample2, result; | |
sample1 = vld1q_f32(inputX); | |
sample2 = vld1q_f32(inputY); | |
result = vmulq_f32(sample1, sample2); |