-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestEffect.cpp
More file actions
32 lines (27 loc) · 966 Bytes
/
Copy pathTestEffect.cpp
File metadata and controls
32 lines (27 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// TestEffect.cpp
// Flow2D
//
// Created by Dan Borthwick on 05/06/2012.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include "TestEffect.h"
void TestEffect::render(RGBABuffer const& rgbaBuffer, int elapsedFrames)
{
rgbaComponent* rgbaComponents = (rgbaComponent*) rgbaBuffer.buffer;
int width = rgbaBuffer.width;
int height = rgbaBuffer.height;
for(int i=0; i < width*height; ++i) {
rgbaComponents[4*i] = i%width;
rgbaComponents[4*i+1] = i/width;
rgbaComponents[4*i+2] = 255;
rgbaComponents[4*i+3] = 0;
}
for (int row = 0; row < height; row++) {
for (int column = 0; column < width; column+=16) {
rgbaComponents[(4 * ((row * width) + column)) + 0] = elapsedFrames;
rgbaComponents[(4 * ((row * width) + column)) + 1] = elapsedFrames;
rgbaComponents[(4 * ((row * width) + column)) + 2] = elapsedFrames;
}
}
}