VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtProceduralImageUtilities.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvUtil/vrvUtil.h>
13 
14 #include <vector>
15 
16 namespace makVrv
17 {
18 
20  {
21  public:
22 
23  // \brief Represents a single mip level of an BGR image.
24  struct MipLevelBGR
25  {
26  int width = 0;
27  int height = 0;
28  std::vector<unsigned char> data; // BGR, 3 bytes per pixel
29  };
30 
31  // Decode BGR [0..255] into normal vector [-1..1]
32  static void decodeNormal(const unsigned char* bgr, float& x, float& y, float& z);
33 
34  // Encode normal vector [-1..1] back into BGR [0..255]
35  static void encodeNormal(unsigned char* bgr, float x, float y, float z);
36 
37  // Average 4 normals and renormalize
38  static void average4Normals(const unsigned char* p0, const unsigned char* p1,
39  const unsigned char* p2, const unsigned char* p3, float& outX, float& outY, float& outZ);
40 
41  // Generate all mip levels and store them in outMips.
42  // baseDataBGR - must be 3 bytes per pixel BGR data.
43  static void generateNormalMapMipChain(int baseWidth, int baseHeight,
44  const unsigned char* baseDataBGR, std::vector<DtProceduralImageUtilities::MipLevelBGR>& outMips);
45 
46  // Generates a normal map image for use with a water shader. The normal map will contain
47  // wave like patterns that are adjustable by the input parameters given to this function.
48  // size - the width and height of the image (it's a square image)
49  // frequency - the simplex noise frequency
50  // octaves - the simplex noise octaves
51  // rigeStrength - the simplex noise ridge strength
52  // worleyCells - the base number of worley pattern cells
53  // worleyBlend - the blend between simplex noise and worley pattern
54  // amplitude - the final heightmap amplitude
55  static std::vector<unsigned char> generateWaterNormalMap(int size, float frequency, int octaves,
56  float ridgeStrength, int worleyCells, float worleyBlend, float amplitude);
57  };
58 
59 }
60 
61 
std::vector< unsigned char > data
Definition: DtProceduralImageUtilities.h:28
#define DT_DLL_VRVUTIL
Definition: vrvUtil.h:34
voidpf void uLong size
Definition: ioapi.h:39
Contains DLL export macros.
Definition: DtProceduralImageUtilities.h:24
Definition: DtProceduralImageUtilities.h:19

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)