view src/dmperlin.h @ 2298:b5abfff07ca9

Add new DMGrowBuf helper functions dmGrowBufCopyOffsSize() and dmGrowBufConstCopyOffsSize().
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Jul 2019 10:54:16 +0300
parents 85fab9d640ec
children 04c035342960
line wrap: on
line source

/*
 * DMLib
 * -- Perlin noise functionality
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2012 Tecnic Software productions (TNSP)
 */
#ifndef DMPERLIN_H
#define DMPERLIN_H

#include "dmlib.h"

#ifdef __cplusplus
extern "C" {
#endif


#define DM_PLNS_B       (0x100)
#define DM_PLNS_BM      (0x0ff)
#define DM_PLNS_N       (0x1000)

typedef struct
{
    int p[DM_PLNS_B + DM_PLNS_B + 2];
    DMFloat g2[DM_PLNS_B + DM_PLNS_B + 2][2];
    DMFloat g1[DM_PLNS_B + DM_PLNS_B + 2];
} DMPerlinContext;


int      dmPerlinInit(DMPerlinContext *ctx, const int seed);
DMFloat  dmPerlinNoise2D(const DMPerlinContext *ctx, DMFloat x, DMFloat y, DMFloat alpha, DMFloat beta, int n);


#ifdef __cplusplus
}
#endif

#endif // DMPERLIN_H