Added the dealer proper.

This commit is contained in:
2021-08-23 09:29:53 -07:00
parent 87e7f599a6
commit 0cd19e7b7c
11 changed files with 244 additions and 75 deletions

View File

@ -0,0 +1,20 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "animation.h"
float animForwardAndBackward(float t) {
return (t < 0.5 ? t : 1 - t);
}
float animForwardAndBackwardScaled(float t) {
return animForwardAndBackward(t) * 2.0f;
}
float animTimeScaleFromFrameTime(int32_t frames, float time) {
return 1.0f / (float)frames / time;
}

View File

@ -0,0 +1,37 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include <dawn/dawn.h>
/**
* Animation tool for converting 0-1 space into a 0-0.5 back to zero space. This
* is intended to make a "Forward then backwards" effect for animation. This
* method will not scale t.
* @param t Time in space to back and fourth on between 0 and 1.
* @returns Forward and backwards time. 0 to 0.5 are as such, 0.5 to 1 are from
* 0.5 to 0.
*/
float animForwardAndBackward(float t);
/**
* Animation tool for converting 0-1 space into a 0-1-0 space. Scaled version of
* animForwardAndBackward().
* @param t Time in space to back and fourth on between 0 and 1.
* @returns Forward and backwards time.
*/
float animForwardAndBackwardScaled(float t);
/**
* Returns the time scale (speed to multiply time range by) for a given frame
* time and frame count. E.g. 3 frames at 0.5 time each would have a time scale
* of 1.5.
*
* @param frames Frames to get the scale of.
* @param time Time to get the scale of.
* @return The time scale.
*/
float animTimeScaleFromFrameTime(int32_t frames, float time);

View File

@ -13,7 +13,7 @@ void skywallInit(primitive_t *primitive) {
vertice_t vertices[SKYWALL_VERTICE_COUNT];
indice_t indices[SKYWALL_INDICE_COUNT];
int32_t n, i, j;
float x, z, p, r;
float x, y, z, p, r;
// For each slice. We iterate slices+1 to do the wrapping mentioned below.
for(i = 0; i < SKYWALL_SLICE_COUNT+1; i++) {
@ -33,12 +33,13 @@ void skywallInit(primitive_t *primitive) {
// Determine the X/Z for the given radian
x = SKYWALL_SIZE * (float)cos(r);
z = SKYWALL_SIZE * (float)sin(r);
y = SKYWALL_SIZE * 1.333f;
// Get the start index for the ertices
n = i * SKYWALL_VERTICES_PER_SLICE;
vertices[n].x = x, vertices[n].y = -SKYWALL_SIZE, vertices[n].z = z;
vertices[n].x = x, vertices[n].y = -y, vertices[n].z = z;
vertices[n].u = p, vertices[n].v = 1;
vertices[n+1].x = x, vertices[n+1].y = SKYWALL_SIZE, vertices[n+1].z = z;
vertices[n+1].x = x, vertices[n+1].y = y, vertices[n+1].z = z;
vertices[n+1].u = p, vertices[n+1].v = 0;
if(i == SKYWALL_SLICE_COUNT) continue;

View File

@ -23,6 +23,6 @@
#define SKYWALL_INDICE_COUNT SKYWALL_INDICES_PER_SLICE*SKYWALL_SLICE_COUNT
/** How big the skywall cylinder is */
#define SKYWALL_SIZE 100
#define SKYWALL_SIZE 10
void skywallInit(primitive_t *primitive);