APEX Framework: Curve.h Source File

NVIDIA APEX

Curve.h
00001 /*
00002  * Copyright (c) 2008-2017, NVIDIA CORPORATION.  All rights reserved.
00003  *
00004  * NVIDIA CORPORATION and its licensors retain all intellectual property
00005  * and proprietary rights in and to this software, related documentation
00006  * and any modifications thereto.  Any use, reproduction, disclosure or
00007  * distribution of this software and related documentation without an express
00008  * license agreement from NVIDIA CORPORATION is strictly prohibited.
00009  */
00010 
00011 
00012 #ifndef CURVE_H
00013 #define CURVE_H
00014 
00015 #include "Apex.h"
00016 #include "nvparameterized/NvParameterized.h"
00017 
00018 namespace nvidia
00019 {
00020 namespace apex
00021 {
00022 
00023 PX_PUSH_PACK_DEFAULT
00024 
00028 template <typename T>
00029 struct Vec2T
00030 {
00034     Vec2T(T _x = T(), T _y = T()) : x(_x), y(_y) { }
00035 
00039     T x;
00040     T y;
00044 
00048     T& operator[](uint32_t ndx)
00049     {
00050         PX_ASSERT(ndx < 2);
00051         return ((T*)&x)[ndx];
00052     }
00053 };
00054 
00058 typedef Vec2T<float> Vec2R;
00059 
00063 class Curve
00064 {
00065 public:
00066     virtual ~Curve() {}
00067 
00072     virtual float evaluate(float x) const = 0;
00073 
00077     virtual uint32_t addControlPoint(const Vec2R& controlPoint) = 0;
00078 
00083     virtual void addControlPoints(::NvParameterized::Interface* param, ::NvParameterized::Handle& hPoints) = 0;
00084 
00090     virtual bool calculateControlPoints(float x, Vec2R& outXPoints, Vec2R& outYPoints) const = 0;
00091 
00095     virtual uint32_t calculateFollowingControlPoint(float xValue) const = 0;
00096 
00098     virtual const Vec2R* getControlPoints(uint32_t& outCount) const = 0;
00099 };
00100 
00101 PX_POP_PACK
00102 
00103 }
00104 } // namespace apex
00105 
00106 #endif // CURVE_H

Generated on Fri Dec 15 2017 13:58:35
Copyright © 2012-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.