CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiProceduralGenerator.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24// Procedural textures generator.
25
26#ifndef __ODGIPROCEDURALGENERATOR_H__
27#define __ODGIPROCEDURALGENERATOR_H__
28
29#include "RootExport.h"
30#include "GiExport.h"
31#include "UInt32Array.h"
32#include "GiImage.h"
33#include "GiMaterial.h"
34
35#include "RxObject.h"
36
37#include "TD_PackPush.h"
38
45{
46 public:
48
50
61 OdGiImageBGRA32 &image, double renderCoef = 1.0) = 0;
62};
63
70
80{
81 public:
86 {
88 kLinearInterpolation = 0,
94 kCosInterpolation
95 };
100 {
102 kClampMode = 0,
104 kWrapMode
105 };
106 protected:
109 public:
114
121
137 void copyGradient(const OdUInt32Array &other);
143 void copyGradient(const ODCOLORREF *colors, OdUInt32 nColors);
151 void createGradient(ODCOLORREF color1, ODCOLORREF color2, OdUInt32 nColors,
161 void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, OdUInt32 nColors,
172 void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, OdUInt32 nColors,
183 void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, OdUInt32 nColors,
196 void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, OdUInt32 nColors,
209 void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, ODCOLORREF color5, OdUInt32 nColors,
224 void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, ODCOLORREF color5, OdUInt32 nColors,
227
234 void fillInterval(ODCOLORREF color, double from = 0.0, double to = 1.0);
250 void generateInterval(ODCOLORREF color1, ODCOLORREF color2, double from = 0.0, double to = 1.0,
262
282 ODCOLORREF colorAt(double at) const;
288 bool isInitialized() const;
294 const OdUInt32Array &asArray() const;
295
307
319 static ODCOLORREF interpolateColor(ODCOLORREF color1, ODCOLORREF color2, double at,
322
329 const OdGiGradientGenerator &operator =(const OdGiGradientGenerator &other);
330
339
345
350 void operator +=(const OdGiGradientGenerator &other);
352 protected:
360 OdUInt32 clampToRange(double inVal) const;
364 double toDoubleRange(OdUInt32 inVal) const;
365
369 static double linterp(double a, double b, double t);
373 static double einterp(double a, double b, double t);
377 static double cinterp(double a, double b, double t);
381 static double ieinterp(double a, double b, double t);
382};
383
393{
394 public:
396
397 // High-level functions
398
410 OdGiImageBGRA32 &image, double renderCoef = 1.0) = 0;
411
423 virtual void generateProceduralWood(OdGiPixelBGRA32 color1, OdGiPixelBGRA32 color2, double radialNoise, double axialNoise, double grainThickness,
424 OdGiImageBGRA32 &image, double renderCoef = 1.0) = 0;
434 virtual void generateProceduralMarble(OdGiPixelBGRA32 stoneColor, OdGiPixelBGRA32 veinColor, double veinSpacing, double veinWidth,
435 OdGiImageBGRA32 &image, double renderCoef = 1.0) = 0;
436
437 // Low-level functions
438
447 virtual void setColorGradient(const OdGiGradientGenerator &gradient) = 0;
453 virtual const OdGiGradientGenerator &colorGradient() const = 0;
454};
455
462
463#include "TD_PackPop.h"
464
465#endif // __ODGIPROCEDURALGENERATOR_H__
#define ODGI_EXPORT
Definition: GiExport.h:35
OdSmartPtr< OdGiProceduralGeneratorPE > OdGiProceduralGeneratorPEPtr
OdSmartPtr< OdGiProceduralGenerator > OdGiProceduralGeneratorPtr
#define ODCOLORREF
Definition: OdPlatform.h:933
unsigned int OdUInt32
unsigned char OdUInt8
void createGradient(ODCOLORREF color1, ODCOLORREF color2, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
OdUInt32 colorsCount() const
void fillInterval(ODCOLORREF color, double from=0.0, double to=1.0)
double toDoubleRange(OdUInt32 inVal) const
void createColorArrayFilled(ODCOLORREF color, OdUInt32 nColors)
static double cinterp(double a, double b, double t)
void generateInterval(ODCOLORREF color1, ODCOLORREF color2, OdUInt32 from, OdUInt32 to, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
void copyGradient(const ODCOLORREF *colors, OdUInt32 nColors)
void createColorArray(OdUInt32 nColors)
static double linterp(double a, double b, double t)
void copyGradient(const OdUInt32Array &other)
ODCOLORREF colorAt(double at) const
OdGiGradientGenerator::AddressMode addressMode() const
void generateInterval(ODCOLORREF color1, ODCOLORREF color2, double from=0.0, double to=1.0, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
static OdGiGradientGenerator createSpectrumGradient(OdUInt32 nColors, OdUInt8 alpha=0)
void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
static double einterp(double a, double b, double t)
void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl1, OdGiGradientGenerator::InterpolationType ipl2)
const OdUInt32Array & asArray() const
bool isInitialized() const
void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, ODCOLORREF color5, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
void appendGradient(const OdGiGradientGenerator &other)
OdUInt32 clampToRange(OdUInt32 inVal) const
ODCOLORREF colorAt(OdUInt32 nColor) const
void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation)
static ODCOLORREF interpolateColor(ODCOLORREF color1, ODCOLORREF color2, double at, OdGiGradientGenerator::InterpolationType ipl=OdGiGradientGenerator::kLinearInterpolation, OdGiGradientGenerator::AddressMode mode=OdGiGradientGenerator::kWrapMode)
void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl1, OdGiGradientGenerator::InterpolationType ipl2, OdGiGradientGenerator::InterpolationType ipl3)
void createGradient(ODCOLORREF color1, ODCOLORREF color2, ODCOLORREF color3, ODCOLORREF color4, ODCOLORREF color5, OdUInt32 nColors, OdGiGradientGenerator::InterpolationType ipl1, OdGiGradientGenerator::InterpolationType ipl2, OdGiGradientGenerator::InterpolationType ipl3, OdGiGradientGenerator::InterpolationType ipl4)
static double ieinterp(double a, double b, double t)
OdGiGradientGenerator(const OdGiGradientGenerator &other)
void setAddressMode(OdGiGradientGenerator::AddressMode mode)
OdUInt32 clampToRange(double inVal) const
void fillInterval(ODCOLORREF color, OdUInt32 from, OdUInt32 to)
virtual void setColorGradient(const OdGiGradientGenerator &gradient)=0
virtual const OdGiGradientGenerator & colorGradient() const =0
virtual void generateProceduralWood(OdGiPixelBGRA32 color1, OdGiPixelBGRA32 color2, double radialNoise, double axialNoise, double grainThickness, OdGiImageBGRA32 &image, double renderCoef=1.0)=0
ODRX_DECLARE_MEMBERS(OdGiProceduralGenerator)
virtual void generateProceduralMarble(OdGiPixelBGRA32 stoneColor, OdGiPixelBGRA32 veinColor, double veinSpacing, double veinWidth, OdGiImageBGRA32 &image, double renderCoef=1.0)=0
virtual bool generateProceduralTexture(OdGiProceduralTexturePtr pTexture, OdGiImageBGRA32 &image, double renderCoef=1.0)=0
ODRX_DECLARE_MEMBERS(OdGiProceduralGeneratorPE)
virtual bool generateProceduralTexture(OdGiProceduralTexturePtr pTexture, OdGiImageBGRA32 &image, double renderCoef=1.0)=0
GLfloat GLfloat GLfloat alpha
Definition: gles2_ext.h:147