Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

party version

  • Loading branch information...
commit e9905df192bd792b5a8f0a50d5394f317678aa13 1 parent 2cf89c7
@kusma authored
View
5 very_last_engine_ever.sln
@@ -1,18 +1,21 @@

Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
+# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "very_last_engine_ever", "very_last_engine_ever\very_last_engine_ever.vcproj", "{CD862F66-C73B-4E6B-87DE-FB5519A91A5D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
+ Sync|Win32 = Sync|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD862F66-C73B-4E6B-87DE-FB5519A91A5D}.Debug|Win32.ActiveCfg = Debug|Win32
{CD862F66-C73B-4E6B-87DE-FB5519A91A5D}.Debug|Win32.Build.0 = Debug|Win32
{CD862F66-C73B-4E6B-87DE-FB5519A91A5D}.Release|Win32.ActiveCfg = Release|Win32
{CD862F66-C73B-4E6B-87DE-FB5519A91A5D}.Release|Win32.Build.0 = Release|Win32
+ {CD862F66-C73B-4E6B-87DE-FB5519A91A5D}.Sync|Win32.ActiveCfg = Sync|Win32
+ {CD862F66-C73B-4E6B-87DE-FB5519A91A5D}.Sync|Win32.Build.0 = Sync|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
4 very_last_engine_ever/data/blur.fx
@@ -7,6 +7,7 @@ float4x4 texcoord_transform;
float2x2 texture_transform;
float3x3 texel_transform;
float brightness = 1.0 / ITERATIONS;
+float2 texcoord_translate = float2(0.5, 0.5);
texture tex;
sampler tex_sampler = sampler_state
@@ -41,8 +42,7 @@ float4 pixel(VS_OUTPUT In) : COLOR
float2 tex = float2(In.tex);
for (int i = 0; i < ITERATIONS; i++)
{
-// color += tex2D(tex_sampler, mul(tex, texture_transform));
- color += tex2D(tex_sampler, float2(tex.x * 0.5 + 0.5f, -tex.y * 0.5 + 0.5f));
+ color += tex2D(tex_sampler, float2(tex.x * 0.5, -tex.y * 0.5) + texcoord_translate);
tex = mul(float3(tex, 1.0), texel_transform);
}
return color * brightness;
View
BIN  very_last_engine_ever/data/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 very_last_engine_ever/data/particle.fx
@@ -11,6 +11,7 @@ float4x4 tex_transform;
float3 up;
float3 left;
+float3 fog_color = float3(1, 1, 1);
float4x4 WorldViewProjection : WORLDVIEWPROJECTION;
@@ -64,9 +65,8 @@ VS_OUTPUT vertex(VS_INPUT In)
float4 pixel(VS_OUTPUT In) : COLOR
{
float fog_factor = In.z;
- float4 fog_color = float4(1, 1, 1, 1);
float4 col = tex2D(tex_samp, In.tex);
- return float4(lerp(col.xyz, fog_color.xyz, fog_factor), col.a);
+ return float4(lerp(col.xyz, fog_color, fog_factor), col.a);
// return tex2D(tex_samp, In.tex);
// return float4(In.tex, 0, 0);
}
View
BIN  very_last_engine_ever/data/rider_igjen-04.mp3
Binary file not shown
View
BIN  very_last_engine_ever/data/rider_igjen-05.mp3
Binary file not shown
View
BIN  very_last_engine_ever/data/stpeters_cross3.dds
Binary file not shown
View
160,650 very_last_engine_ever/data/test.x
0 additions, 160,650 deletions not shown
View
11 very_last_engine_ever/data/tunelle.fx
@@ -9,6 +9,8 @@ float4x4 View : VIEW;
float fade = 1.0;
float overbright = 1.0;
+float3 fog_color = float3(1, 1, 1);
+
// textures
texture map;
@@ -70,13 +72,12 @@ float4 pixel(VS_OUTPUT In) : COLOR
// float3 ref_vec = reflect(N, L);
float3 ref_vec = reflect(L, N);
- color = max(dot(-N, L), 0);
- color += texCUBE(env_samp, ref_vec) * pow(1 - max(dot(-N, L), 0), 1);
+// color = max(dot(-N, L), 0);
+ color = 1; // texCUBE(env_samp, ref_vec);
color *= tex2D(tex_samp, In.tex);
- color *= 0.25;
+ color *= 0.5;
- float4 fog_color = float4(1, 1, 1, 1);
- return float4(lerp(color.xyz, fog_color.xyz, In.fog_factor), color.a);
+ return float4(lerp(color.xyz, fog_color, In.fog_factor), color.a);
return color * overbright;
}
View
9 very_last_engine_ever/engine/particlestreamer.h
@@ -95,13 +95,7 @@ namespace engine
*locked_pointer++ = pos.z;
*locked_pointer++ = size;
}
-
- if (--locked_particles == 0)
- {
- end();
- draw();
- begin();
- }
+ locked_particles--;
}
void end()
@@ -112,6 +106,7 @@ namespace engine
void draw()
{
+
int max_vertex = PARTICLE_STREAMER_VERTEX_COUNT - (locked_particles * 4);
int primitive_count = 2 * (PARTICLE_STREAMER_PARTICLE_COUNT - locked_particles);
View
4 very_last_engine_ever/main.cpp
@@ -55,7 +55,7 @@ int main(int /*argc*/, char* /*argv*/ [])
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
-// _CrtSetBreakAlloc(68);
+// _CrtSetBreakAlloc(68)
#endif
_Module.Init(NULL, GetModuleHandle(0));
@@ -92,7 +92,7 @@ int main(int /*argc*/, char* /*argv*/ [])
#ifndef VJSYS
if (!BASS_Init(config.get_soundcard(), 44100, BASS_DEVICE_LATENCY, 0, 0)) throw FatalException("failed to init bass");
- stream = BASS_StreamCreateFile(false, "data/rider_igjen-04.mp3", 0, 0, BASS_MP3_SETPOS | ((0 == config.get_soundcard()) ? BASS_STREAM_DECODE : 0));
+ stream = BASS_StreamCreateFile(false, "data/rider_igjen-06.mp3", 0, 0, BASS_MP3_SETPOS | ((0 == config.get_soundcard()) ? BASS_STREAM_DECODE : 0));
if (!stream) throw FatalException("failed to open tune");
#else
BASS_RecordInit(config.get_soundcard());
View
548 very_last_engine_ever/megademo.h
@@ -2,6 +2,7 @@
#define MEGADEMO_H
#define END_TIME (60 * 3 + 30) /* 3:30 */
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#include "renderer/texture.h"
#include "renderer/rendertexture.h"
@@ -9,6 +10,7 @@
#include "engine/demo.h"
#include "engine/image.h"
#include "engine/particlestreamer.h"
+#include "engine/particlecloud.h"
#include "math/vector3.h"
#include "math/vector2.h"
#include "math/matrix4x4.h"
@@ -24,17 +26,78 @@ using math::Matrix4x4;
namespace engine
{
- Texture load_texture(renderer::Device &device, std::string filename)
+ Texture load_texture(renderer::Device &device, ::std::string filename)
{
Texture tex;
HRESULT hr = D3DXCreateTextureFromFile(device, filename.c_str(), &tex);
- if (FAILED(hr)) throw core::FatalException(std::string("failed to load mesh \"") + filename + std::string("\"\n\n") + core::d3d_get_error(hr));
+ if (FAILED(hr)) throw core::FatalException(::std::string("failed to load mesh \"") + filename + ::std::string("\"\n\n") + core::d3d_get_error(hr));
return tex;
}
}
+class Video
+{
+public:
+ Texture &get_tex(float pos)
+ {
+ assert(0 != textures.size());
+ int idx = pos * textures.size();
+ idx %= textures.size();
+ return textures[idx];
+ }
+
+ /**
+
+ 0 0
+ 1 1
+ 2 2
+ 3 3
+ 4 4
+ 3 5
+ 2 6
+ 1 7
+ 0 8
+ 1 9
+ 2 10
+
+ */
+
+ Texture &get_tex_pingpong(float pos)
+ {
+ assert(0 != textures.size());
+ int idx = pos * textures.size();
+ idx %= (textures.size() * 2) - 2;
+ if (idx >= textures.size()) idx = textures.size() - 1 - (idx - textures.size());
+ assert(idx >= 0);
+ assert(idx < textures.size());
+ return textures[idx];
+ }
+
+ std::vector<Texture> textures;
+};
+
+Video load_video(Device &device, std::string folder)
+{
+ Video vid;
+ for (int i = 0; true; ++i)
+ {
+ char temp[256];
+ sprintf(temp, "%s/%04d.jpg", folder.c_str(), i);
+ Texture tex;
+ if (FAILED(D3DXCreateTextureFromFile(device, temp, &tex))) break;
+ vid.textures.push_back(tex);
+ }
+
+ if (0 == vid.textures.size())
+ {
+ throw FatalException("no frames in video");
+ }
+
+ return vid;
+}
+
void set_ramp(float alphas[], float base)
{
for (unsigned i = 0; i < 8; i++)
@@ -53,87 +116,26 @@ void blit(IDirect3DDevice9 *device, IDirect3DTexture9 *tex, Effect &eff, Mesh &p
eff.draw(polygon);
}
-template <typename T>
-void insertion_sort(T* a, size_t len)
+bool blink_inout(float time, float startblink, float endblink, float blinklen)
{
- for (int j = 2; j < len; j++)
- {
- for (int k = 0; k < j; k++)
- {
- if (a[j] < a[k])
- {
- temp = a[k];
- a[k] = a[j];
- a[j] = temp;
- }
- }
- }
+ return ((time > (startblink + blinklen) && time < (endblink - blinklen)) || ((time > startblink && time < endblink) && (int(time) & 1)));
}
-#if 0
-typedef D3DXVECTOR2 Vector2;
-/* typedef D3DXVECTOR3 Vector3; */
-typedef D3DXVECTOR4 Vector4;
-#endif
-
-class Particle
-{
-public:
- Particle(const Vector3 &pos, const float size) : pos(pos), size(size) {}
-
- Vector3 pos;
- float size;
-};
-
-
-#include <list>
-
-class ParticleCompare
-{
-public:
- ParticleCompare(const Vector3 &dir) : dir(dir) {}
-
- bool operator()(const Particle &a, const Particle &b)
- {
- float za = dir.x * a.pos.x + dir.y * a.pos.y + dir.z * a.pos.z;
- float zb = dir.x * b.pos.x + dir.y * b.pos.y + dir.z * b.pos.z;
- if (fabs(za - zb) > 1e-5) return za > zb;
- else return false;
- }
-
- const Vector3 &dir;
-};
-
-#include <algorithm>
-
-class ParticleCloud
-{
-public:
- ParticleCloud() : streamer(NULL) {}
- ParticleCloud(engine::ParticleStreamer *streamer) : streamer(streamer) {}
-
- void sort(const Vector3 &dir)
- {
- particles.sort(ParticleCompare(dir));
- }
-
- std::list<Particle> particles;
- engine::ParticleStreamer *streamer;
-};
-
Matrix4x4 texture_matrix(const Texture &tex)
{
Matrix4x4 mat, trans1, trans2, scale;
- D3DXMatrixIdentity(&trans1);
- trans1._31 = 0.5 / tex.get_surface().get_desc().Width;
- trans1._32 = 0.5 / tex.get_surface().get_desc().Height;
+
+ // D3DXMatrixIdentity(&trans2);
+// trans1._31 = 0.5;
+// trans1._32 = 0.5;
D3DXMatrixIdentity(&trans2);
- trans1._31 = 0.5;
- trans1._32 = 0.5;
+ trans2._31 = -10.5 / tex.get_surface().get_desc().Width;
+ trans2._32 = -10.5 / tex.get_surface().get_desc().Height;
D3DXMatrixScaling(&scale, 0.5, 0.5, 1.0);
- mat = scale * trans2;
+ return trans2;
+// mat = trans2 * scale;
// mat = trans1 * scale;
return mat;
@@ -143,7 +145,7 @@ Matrix4x4 radialblur_matrix(const Texture &tex, const Vector2 &center, const flo
{
Matrix4x4 mat;
mat.make_scaling(Vector3(amt, amt, 1.0));
-#if 1
+#if 0
mat._31 = 0.005;
mat._32 = 0.005;
#endif
@@ -160,16 +162,38 @@ class MegaDemo : public engine::Demo
Mesh tunelle_mesh;
Texture tunelle_tex;
+ Effect tunelle_fx;
+
+ Mesh kuber_mesh;
+ Texture kuber_tex;
+ Effect kuber_fx;
Effect test_fx;
Effect blur_fx;
Effect tex_fx;
- Effect tunelle_fx;
Effect particle_fx;
Texture logo_tex;
Image logo;
+ Texture analog_tex;
+ Image analog;
+
+ Texture ramme_tex;
+ Image ramme;
+
+ Texture end_tex;
+ Image end;
+
+ Texture end2_tex;
+ Image end2;
+
+ Texture greets_tex;
+ Image greets;
+
+ Texture fucks_tex;
+ Image fucks;
+
RenderTexture blurme1_tex;
Image blurme1;
@@ -177,6 +201,7 @@ class MegaDemo : public engine::Demo
Image blurme2;
Texture bartikkel_tex;
+ CComPtr<IDirect3DCubeTexture9> env;
// engine::TextureProxy texloader;
@@ -187,13 +212,21 @@ class MegaDemo : public engine::Demo
Sync &sync;
SyncTrack &fade, &flash, &part;
SyncTrack &xrot, &yrot, &zrot;
+ SyncTrack &zrot2, &scrolly;
SyncTrack &cam_seed, &cam_rand;
SyncTrack &cam_x, &cam_y, &cam_z;
+ SyncTrack &at_x, &at_y, &at_z;
SyncTrack &cam_fov;
SyncTrack &blur_amt;
+ SyncTrack &clear_color_param;
+ SyncTrack &morph;
+ SyncTrack &vid_track;
+ SyncTrack &vid_flip;
+
+ std::vector<Video> vids;
engine::ParticleStreamer streamer;
- ParticleCloud cloud;
+ engine::ParticleCloud<float> cloud;
public:
MegaDemo(renderer::Device &device, renderer::Surface &backbuffer, float aspect, Sync &sync) :
@@ -207,13 +240,23 @@ class MegaDemo : public engine::Demo
xrot( sync.getTrack("x", "rotation", 5, true)),
yrot( sync.getTrack("y", "rotation", 5, true)),
zrot( sync.getTrack("z", "rotation", 5, true)),
+ zrot2( sync.getTrack("z2", "rotation", 5, true)),
+ scrolly( sync.getTrack("scrolly", "rotation", 5, true)),
+
+ vid_track( sync.getTrack("track", "vid", 5, true)),
+ vid_flip( sync.getTrack("flip", "vid", 5, true)),
cam_x( sync.getTrack("x", "cam", 5, true)),
cam_y( sync.getTrack("y", "cam", 5, true)),
cam_z( sync.getTrack("z", "cam", 5, true)),
cam_fov( sync.getTrack("fov", "cam", 5, true)),
cam_seed( sync.getTrack("seed", "cam", 5, true)),
- cam_rand( sync.getTrack("rand", "cam", 5, true))
+ cam_rand( sync.getTrack("rand", "cam", 5, true)),
+ at_x( sync.getTrack("x", "at", 5, true)),
+ at_y( sync.getTrack("y", "at", 5, true)),
+ at_z( sync.getTrack("z", "at", 5, true)),
+ clear_color_param( sync.getTrack("clear", "global", 5, true)),
+ morph( sync.getTrack("morph", "global", 5, true))
{
streamer = engine::ParticleStreamer(device);
@@ -226,33 +269,55 @@ class MegaDemo : public engine::Demo
tunelle_mesh = engine::load_mesh(device, "data/tunelle.x");
tunelle_tex = engine::load_texture(device, "data/tunelle.dds");
+ tunelle_fx = engine::load_effect(device, "data/tunelle.fx");
+
+ kuber_mesh = engine::load_mesh(device, "data/kuber.x");
+ kuber_tex = engine::load_texture(device, "data/kuber.dds");
+ kuber_fx = engine::load_effect(device, "data/kuber.fx");
test_fx = engine::load_effect(device, "data/test.fx");
blur_fx = engine::load_effect(device, "data/blur.fx");
tex_fx = engine::load_effect(device, "data/tex.fx");
particle_fx = engine::load_effect(device, "data/particle.fx");
- tunelle_fx = engine::load_effect(device, "data/tunelle.fx");
logo_tex = engine::load_texture(device, "data/logo.png");
logo = Image(logo_tex, tex_fx, polygon);
+
+ analog_tex = engine::load_texture(device, "data/analog.dds");
+ analog = Image(analog_tex, tex_fx, polygon);
+
+ ramme_tex = engine::load_texture(device, "data/ramme.png");
+ ramme = Image(ramme_tex, tex_fx, polygon);
+ end_tex = engine::load_texture(device, "data/end.dds");
+ end = Image(end_tex, tex_fx, polygon);
+
+ end2_tex = engine::load_texture(device, "data/end2.dds");
+ end2 = Image(end2_tex, tex_fx, polygon);
+
+ greets_tex = engine::load_texture(device, "data/greets.dds");
+ greets = Image(greets_tex, tex_fx, polygon);
+/*
+ fucks_tex = engine::load_texture(device, "data/fucks.dds");
+ fucks = Image(fucks_tex, tex_fx, polygon);
+*/
bartikkel_tex = engine::load_texture(device, "data/bartikkel.dds");
- CComPtr<IDirect3DCubeTexture9> env;
d3d_err(D3DXCreateCubeTextureFromFile(device, "data/stpeters_cross2.dds", &env));
test_fx->SetTexture("env", env);
-
- blurme1_tex = RenderTexture(device, backbuffer.get_desc().Width / 2, int(backbuffer.get_desc().Height * aspect * (9 / 16.f)) / 2);
- blurme2_tex = RenderTexture(device, backbuffer.get_desc().Width / 2, int(backbuffer.get_desc().Height * aspect * (9 / 16.f)) / 2);
- for (int i = 0; i < 1024 * 16; ++i)
+ log::printf("aspect correction: %f\n", aspect * (16.f / 9));
+ blurme1_tex = RenderTexture(device, backbuffer.get_desc().Width, int(backbuffer.get_desc().Width / (16.f / 9.f)));
+ blurme2_tex = RenderTexture(device, backbuffer.get_desc().Width, int(backbuffer.get_desc().Width / (16.f / 9.f)));
+#if 1
+ for (int i = 0; i < 1024 * 8; ++i)
{
#if 1
float x = (randf() - 0.5f) * 200;
float z = (randf() - 0.5f) * 200;
float y = (randf() - 0.5f) * 200;
- float s = (randf() + 0.5f) * 4.f;
-#else
+ float s = (randf() + 0.5f) * 3.f;
+#elif 0
float p = i;
float rad = 50 + sin(p * 0.0001f) * 10;
float x = (sin(p * 0.01)) * rad;
@@ -261,17 +326,57 @@ class MegaDemo : public engine::Demo
float s = 3.f + sin(p * 0.189) * 2;
s *= 0.5;
#endif
- cloud.particles.insert(cloud.particles.end(), Particle(Vector3(x, y, z), s));
+ cloud.particles.insert(cloud.particles.end(), engine::Particle<float>(Vector3(x, y, z), s));
}
- }
+#else
+ for (int j = 0; j < 1; ++j)
+ {
+ float x = (randf() - 0.5f);
+ float z = (randf() - 0.5f);
+ float y = (randf() - 0.5f);
+ Vector3 pos(x, y, z);
+ pos.normalize();
+
+ Vector3 dir = pos;
+
+ const int max = 4096;
+ for (int i = 0; i < max; ++i)
+ {
+// cloud.particles.insert(cloud.particles.end(), engine::Particle(pos, 1.0 / (1 + (i * 0.05f)) ));
+// float s = min(float(i) / max, float(max - i) / max);
+ float s = float(i) / max;
+
+ pos = Vector3(cos(s * M_PI * 10), sin(s * M_PI * 8), cos(1 - s * M_PI * 9));
+ pos.x += cos(pos.y * 2);
+ pos.y += cos(pos.z * 2);
+ pos.z += cos(pos.x * 2);
+
+ pos *= 3;
+// pos *= sin(s);
+
+ s = 1 - cos(s * M_PI * 2);
+ s = (1 + cos(s * M_PI * 10) * 0.75) * s;
+ s *= 0.35;
+ cloud.particles.insert(cloud.particles.end(), engine::Particle(pos, s));
+ pos += dir * 0.05;
+ }
+ }
+#endif
+ vids.push_back(load_video(device, "data/vid1"));
+ vids.push_back(load_video(device, "data/vid2"));
+ vids.push_back(load_video(device, "data/vid3"));
+ vids.push_back(load_video(device, "data/vid4"));
+ }
+
void start()
{
/* music.play(); */
}
-
+
void draw(float time)
{
+ time -= 10.f / (1000000);
double beat = time * (double(BPM) / 60);
#ifdef VJSYS
@@ -286,15 +391,42 @@ class MegaDemo : public engine::Demo
BASS_ChannelGetData(stream, spectrum, BASS_DATA_FFT512);
}
+ float spec1_val = spectrum[0];
+
+ D3DXCOLOR clear_color;
+ clear_color.r = clear_color_param.getFloatValue() * (1.0 / 256);
+ clear_color.g = clear_color_param.getFloatValue() * (1.0 / 256);
+ clear_color.b = clear_color_param.getFloatValue() * (1.0 / 256);
+/*
+ clear_color.r = 0;
+ clear_color.g = 0;
+ clear_color.b = 0;
+*/
+
+ static float last_blink = 0.f;
+ float blink = last_blink + (spectrum[0] - last_blink) * 0.1f;
+ last_blink = blink;
+
+ blink *= 0.05;
+
+ clear_color.r += blink;
+ clear_color.g += blink;
+ clear_color.b += blink;
+
+ particle_fx->SetFloatArray("fog_color", clear_color, 3);
+
+
+
if (true)
{
device->SetRenderTarget(0, blurme1_tex.get_surface());
- device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0xffffff, 1.f, 0);
+ device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, clear_color, 1.f, 0);
// setup projection
D3DXMATRIX proj;
D3DXMatrixPerspectiveFovLH(&proj, D3DXToRadian(cam_fov.getFloatValue()), 16.f / 9, 0.01f, 1000.f);
+ D3DXMatrixPerspectiveFovLH(&proj, D3DXToRadian(90.0), float(blurme1_tex.get_surface().get_desc().Width) / blurme1_tex.get_surface().get_desc().Height, 0.01f, 1000.f);
device->SetTransform(D3DTS_PROJECTION, &proj);
float rot = time * 0.4f;
@@ -305,14 +437,22 @@ class MegaDemo : public engine::Demo
// setup camera (animate parameters)
srand(0);
- D3DXVECTOR3 at(0, 0.f, 10.f);
+ Vector3 at(0, 0.f, 0.f);
+ at = Vector3(at_x.getFloatValue(), at_y.getFloatValue(), at_z.getFloatValue());
D3DXVECTOR3 up(0.f, 1.f, 0.f);
- D3DXVECTOR3 eye(
+ Vector3 eye = Vector3
+ (
cam_x.getFloatValue(), // cam_rand.getFloatValue(),
cam_y.getFloatValue(), // cam_rand.getFloatValue(),
cam_z.getFloatValue()
- ); // cam_rand.getFloatValue(),
-
+ ); // cam_rand.getFloatValue(),
+/*
+ eye = Vector3(
+ sin(time) * 4,
+ 0.f,
+ cos(time) * 4
+ );
+*/
// setup camera (view matrix)
D3DXMATRIX view;
D3DXMatrixLookAtLH(&view, &eye, &at, &up);
@@ -330,86 +470,132 @@ class MegaDemo : public engine::Demo
device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
test_fx.draw(mesh2);
*/
-
- if (beat > (64 + 16))
+ if (beat < 256 - 64)
{
- for (int i = 0; i < 10; ++i)
- {
- Vector3 scale(0.1, 0.1, 0.1);
- Vector3 translation(0,0,i * 25);
- D3DXQUATERNION rotation;
- D3DXQuaternionRotationYawPitchRoll(&rotation, 0, M_PI / 2, 0);
- D3DXMatrixTransformation(&world, NULL, NULL, &scale, NULL, &rotation, &translation);
- tunelle_fx.set_matrices(world, view, proj);
- tunelle_fx->SetTexture("map", tunelle_tex);
- tunelle_fx->SetFloat("overbright", 1.0);
- tunelle_fx->CommitChanges();
- device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
- tunelle_fx.draw(tunelle_mesh);
+ if (beat > (64 + 8))
+ {
+ tunelle_fx->SetFloatArray("fog_color", clear_color, 3);
+ for (int i = 0; i < 24; ++i)
+ {
+ Vector3 scale(0.1, 0.1, 0.1);
+ Vector3 translation(0,0,i * 25);
+ D3DXQUATERNION rotation;
+ D3DXQuaternionRotationYawPitchRoll(&rotation, 0, M_PI / 2, 0);
+ D3DXQUATERNION rotation2;
+ D3DXQuaternionRotationYawPitchRoll(&rotation2, 0, 0, zrot.getFloatValue());
+
+ rotation *= rotation2;
+
+ Matrix4x4 world;
+ D3DXMatrixTransformation(&world, NULL, NULL, &scale, NULL, &rotation, &translation);
+
+ tunelle_fx.set_matrices(world, view, proj);
+ tunelle_fx->SetTexture("map", tunelle_tex);
+ tunelle_fx->SetFloat("overbright", 1.0);
+ tunelle_fx->CommitChanges();
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
+ tunelle_fx.draw(tunelle_mesh);
+ }
}
- }
- world.make_identity();
+ if (beat > (64 + 64))
+ {
+ Vector3 scale(0.05, 0.05, 0.05);
+ Vector3 translation(0, 0, scrolly.getFloatValue());
+ D3DXQUATERNION rotation;
+ D3DXQuaternionRotationYawPitchRoll(&rotation, 0, 0, zrot2.getFloatValue());
- Matrix4x4 modelview = world * view;
- cloud.sort(Vector3(modelview._13, modelview._23, modelview._33));
+ Matrix4x4 world;
+ D3DXMatrixTransformation(&world, NULL, NULL, &scale, NULL, &rotation, &translation);
- particle_fx.set_matrices(world, view, proj);
- particle_fx->SetTexture("tex", bartikkel_tex);
+ kuber_fx->SetFloatArray("fog_color", clear_color, 3);
+ kuber_fx->SetFloat("morph", morph.getFloatValue() * (1.f / 256));
+ kuber_fx.set_matrices(world, view, proj);
+ kuber_fx->SetTexture("map", kuber_tex);
+ kuber_fx->SetTexture("env", env);
+ kuber_fx->CommitChanges();
+ kuber_fx.draw(kuber_mesh);
+ }
- {
- Vector3 up(modelview._12, modelview._22, modelview._32);
- Vector3 left(modelview._11, modelview._21, modelview._31);
- up.normalize();
- left.normalize();
-
- particle_fx->SetFloatArray("up", up, 3);
- particle_fx->SetFloatArray("left", left, 3);
- particle_fx->CommitChanges();
- }
- device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
- device->SetRenderState(D3DRS_ZWRITEENABLE, false);
+ world.make_identity();
- std::list<Particle>::const_iterator iter = cloud.particles.begin();
- bool iter_done = false;
+ Matrix4x4 modelview = world * view;
+ cloud.sort(Vector3(modelview._13, modelview._23, modelview._33));
+
+ particle_fx.set_matrices(world, view, proj);
+ particle_fx->SetTexture("tex", bartikkel_tex);
+
+ {
+ Vector3 up(modelview._12, modelview._22, modelview._32);
+ Vector3 left(modelview._11, modelview._21, modelview._31);
+ up.normalize();
+ left.normalize();
+
+ particle_fx->SetFloatArray("up", up, 3);
+ particle_fx->SetFloatArray("left", left, 3);
+ particle_fx->CommitChanges();
+ }
- int cnt = 0;
- while (!iter_done)
- {
- streamer.begin();
- for (int i = 0; i < 1023; ++i)
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
+ device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
+ device->SetRenderState(D3DRS_ZWRITEENABLE, false);
+
+ std::list<engine::Particle<float> >::const_iterator iter = cloud.particles.begin();
+ bool iter_done = false;
+
+ while (!iter_done)
{
- cnt++;
- if (cloud.particles.end() == iter)
+ streamer.begin();
+ for (int i = 0; i < 1024; ++i)
{
- iter_done = true;
- break;
+ streamer.add(
+ Vector3(iter->pos.x,
+ iter->pos.y,
+ iter->pos.z
+ ),
+ iter->data // + (1 - fmod(beat, 1.0)) * 2
+ );
+ ++iter;
+
+ if (cloud.particles.end() == iter)
+ {
+ iter_done = true;
+ break;
+ }
}
-
- streamer.add(
- Vector3(iter->pos.x,
- iter->pos.y,
- iter->pos.z
- ),
-#if 0
- 2.f + sin(cnt * 0.00589)
-#else
- iter->size + (1 - fmod(beat, 1.0)) * 2
-#endif
- );
- ++iter;
+ streamer.end();
+ particle_fx.draw(streamer);
}
- streamer.end();
- particle_fx.draw(streamer);
+
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
+ device->SetRenderState(D3DRS_ZWRITEENABLE, true);
}
+ else
+ {
+ int vid = vid_track.getIntValue() % vids.size();
- device->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
- device->SetRenderState(D3DRS_ZWRITEENABLE, true);
+ float tbeat = beat;
+ if (vid == 1) beat *= 2;
+ float x_scale = 1.0f;
+ if (vid_flip.getIntValue() & 1) x_scale = -1.0f;
+
+ Matrix4x4 tex_transform;
+ tex_transform.make_scaling(Vector3(x_scale, 1, 1));
+ tex_fx->SetMatrix("tex_transform", &tex_transform);
+
+ blit(device, vids[vid].get_tex_pingpong(beat), tex_fx, polygon);
+
+ if (beat > (512 + 128 + 32 - 8))
+ {
+ tex_fx->SetFloat("alpha", 1.0);
+ end2.draw(device);
+ }
+
+ }
Matrix4x4 texcoord_transform;
Matrix4x4 texel_transform;
@@ -418,6 +604,11 @@ class MegaDemo : public engine::Demo
// float amt = 1.0 - pow((1.0 - fmod(beat / 2, 1.0)) * 0.1, 2.0);
float amt = 1.0 - pow((blur_amt.getFloatValue()) * 0.1, 2.0);
+ Vector3 texcoord_translate(
+ 0.5 + (0.5 / blurme1_tex.get_surface().get_desc().Width),
+ 0.5 + (0.5 / blurme1_tex.get_surface().get_desc().Height),
+ 0.0);
+ blur_fx->SetFloatArray("texcoord_translate", texcoord_translate, 2);
texcoord_transform.make_scaling(Vector3(1,1,1));
blur_fx->SetMatrix("texcoord_transform", &texcoord_transform);
blur_fx->SetMatrix("texture_transform", &texture_transform);
@@ -457,16 +648,53 @@ class MegaDemo : public engine::Demo
blit(device, blurme2_tex, blur_fx, polygon);
// blur.draw(device);
+
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
Matrix4x4 tex_transform;
- tex_transform.make_scaling(Vector3(pow(1.0 - fmod(beat / 4, 1.0), 8.0) * cos(beat * M_PI * 4) * 0.25 + 1.0, 1, 1));
+// tex_transform.make_scaling(Vector3(pow(1.0 - fmod(beat / 4, 1.0), 8.0) * cos(beat * M_PI * 4) * 0.25 + 1.0, 1, 1));
+ tex_transform.make_scaling(Vector3(1.0, 1, 1));
tex_fx->SetMatrix("tex_transform", &tex_transform);
- logo.draw(device);
+
+ if (beat > 256 + 64 && (beat < (512 + 128 + 32 - 8)))
+ {
+ tex_fx->SetFloat("alpha", fade.getFloatValue());
+ end.draw(device);
+ }
+
+ tex_fx->SetFloat("alpha", 1.0f);
+ ramme.draw(device);
+
+// if (blink_inout(beat * 8, (64 + 4) * 8, (64 + 4 + 8) * 8, 1 * 8))
+ if ((beat > 64) && (beat < (64 + 16)))
+ {
+ tex_transform.make_scaling(Vector3(1, 1, 1));
+ tex_fx->SetMatrix("tex_transform", &tex_transform);
+ if (beat < (64 + 8)) tex_fx->SetFloat("alpha", 1.f - clear_color.r);
+ else tex_fx->SetFloat("alpha", 1.f - (beat - (64 + 8)) / 8 );
+ logo.draw(device);
+ }
+
+ if (blink_inout(beat * 8, (64 + 18) * 8, (64 + 18 + 8) * 8, 1 * 8))
+ {
+ tex_transform.make_scaling(Vector3(pow(1.0 - fmod(beat / 4, 1.0), 8.0) * cos(beat * M_PI * 4) * 0.25 + 1.0, 1, 1));
+ tex_fx->SetMatrix("tex_transform", &tex_transform);
+ tex_fx->SetFloat("alpha", 1.0f);
+ analog.draw(device);
+ }
+
+ if (blink_inout(beat * 8, (256 + 32) * 8, (256 + 64) * 8, 1 * 8))
+ {
+ tex_transform.make_scaling(Vector3(pow(1.0 - fmod(beat / 4, 1.0), 8.0) * cos(beat * M_PI * 4) * 0.25 + 1.0, 1, 1));
+ tex_fx->SetMatrix("tex_transform", &tex_transform);
+ tex_fx->SetFloat("alpha", 1.0f);
+ greets.draw(device);
+ }
+
device->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
#endif
-
+
if (time > END_TIME) done = true;
}
};
View
2  very_last_engine_ever/very_last_engine_ever.vcproj
@@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="C:\WTL75\include;include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;D3D_DEBUG_INFO;_CRT_SECURE_NO_DEPRECATE"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;D3D_DEBUG_INFO;_CRT_SECURE_NO_DEPRECATE;WINDOWED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"

0 comments on commit e9905df

Please sign in to comment.
Something went wrong with that request. Please try again.