[EditorPlugin] VertexRenderer
Posted: 17 Feb 2018, 17:06
[media]https://cdn.discordapp.com/attachments/ ... yramid.mp4[/media]
Inspired by OpenGL rendering you define an "ArrayBuffer" with vertex and optionally data values, set how the values are interpreted as vertex or data[1] and then it get's passed through the pipeline of being potentially transformed in the "VertexShader"[2], the values are interpreted as block-coordinates and lastly the block to be placed may be influenced in the "FragmentShader"[3].
Of course the whole "draw triangles" thing is not as useful as it is when drawing primitives, everything is a mess, might break unintendedly, is blocking and awfully slow (64³ maps of course render a nicer result, but are even slower) - especially when using the useless animation loop, but it was a fun project testing yet again what useless stuff can be done with the possibilities provided to us.
Would be cool if someone would actually load objects and post pictures
[1]
[2]
[3]
Source
Inspired by OpenGL rendering you define an "ArrayBuffer" with vertex and optionally data values, set how the values are interpreted as vertex or data[1] and then it get's passed through the pipeline of being potentially transformed in the "VertexShader"[2], the values are interpreted as block-coordinates and lastly the block to be placed may be influenced in the "FragmentShader"[3].
Of course the whole "draw triangles" thing is not as useful as it is when drawing primitives, everything is a mess, might break unintendedly, is blocking and awfully slow (64³ maps of course render a nicer result, but are even slower) - especially when using the useless animation loop, but it was a fun project testing yet again what useless stuff can be done with the possibilities provided to us.
Would be cool if someone would actually load objects and post pictures

[1]
Code: Select all
G_ArrayBuffer = [
// x, y, z, data[0]
-.3, 0., 0., 0.,
.2, .3, 0., 0.,
.2, -.3, 0., 0.,
.2, .3, 0., 1.,
.2, -.3, 0., 1.,
0., 0., .6, 1.,
-.3, 0., 0., 2.,
.2, -.3, 0., 2.,
0., 0., .6, 2.,
-.3, 0., 0., 3.,
.2, .3, 0., 3.,
0., 0., .6, 3.
];
G_VertexSize = 3;
G_DataSize = 1;
Code: Select all
Position = _V3Mul(Position, 1.5);
declare X = Position.X * MathLib::Cos(G_Angle) - Position.Y * MathLib::Sin(G_Angle);
declare Y = Position.X * MathLib::Sin(G_Angle) + Position.Y * MathLib::Cos(G_Angle);
Position.X = X;
Position.Y = Y;
Code: Select all
if (Data[0] >= 0.9) {
BlockModel = GetBlockModelFromName("StadiumCircuitTurbo");
}
if (Data[0] >= 1.9) {
BlockModel = GetBlockModelFromName("StadiumControlRoadGlass");
}
if (Data[0] >= 2.9) {
BlockModel = GetBlockModelFromName("StadiumTubeRoadSoundSystem");
}