opennurbs_texture_mapping.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 ////////////////////////////////////////////////////////////////
18 //
19 // defines ON_TextureMapping
20 //
21 ////////////////////////////////////////////////////////////////
22 
23 #if !defined(OPENNURBS_TEXTURE_MAPPING_INC_)
24 #define OPENNURBS_TEXTURE_MAPPING_INC_
25 
26 ///////////////////////////////////////////////////////////////////////////////
27 //
28 // Class ON_TextureMapping
29 //
30 class ON_Line;
31 class ON_BrepFace;
32 class ON_3dPoint;
33 
34 typedef int ( *TEXMAP_INTERSECT_LINE_SURFACE )( const ON_Line*, const ON_BrepFace*, ON_SimpleArray<ON_X_EVENT>& );
35 typedef bool ( *TEXMAP_BREP_FACE_CLOSEST_POINT )( const ON_BrepFace*, const ON_3dPoint*, ON_3dPoint& );
36 
37 class ON_CLASS ON_TextureMapping : public ON_ModelComponent
38 {
39  ON_OBJECT_DECLARE(ON_TextureMapping);
40 
41 public:
42 
43  static const ON_TextureMapping Unset; // nil id
44 
45  // ON_TextureMapping::SurfaceParameterTextureMapping
46  // has m_type = ON_TextureMapping::srfp_mapping and m_id = nil;
48 
49  /*
50  Parameters:
51  model_component_reference - [in]
52  none_return_value - [in]
53  value to return if ON_Material::Cast(model_component_ref.ModelComponent())
54  is nullptr
55  Returns:
56  If ON_Material::Cast(model_component_ref.ModelComponent()) is not nullptr,
57  that pointer is returned. Otherwise, none_return_value is returned.
58  */
59  static const ON_TextureMapping* FromModelComponentRef(
60  const class ON_ModelComponentReference& model_component_reference,
61  const ON_TextureMapping* none_return_value
62  );
63 
64 public:
65  //////////////////////////////////////////////////////////
66  //
67  // Mapping types:
68  //
69  // You can either calculate texture coordinates based on
70  // the parameterization of the surface used to create a mesh,
71  // or project the natural parameterization from a mapping
72  // primitive, like a plane, sphere, box, or cylinder.
73  //
74  // Do not change TYPE enum values - they are saved in 3dm files.
75  //
76  enum class TYPE : unsigned int
77  {
78  no_mapping = 0,
79  srfp_mapping = 1, // u,v = linear transform of surface params,w = 0
80  plane_mapping = 2, // u,v,w = 3d coordinates wrt frame
81  cylinder_mapping = 3, // u,v,w = logitude, height, radius
82  sphere_mapping = 4, // (u,v,w) = longitude,latitude,radius
83  box_mapping = 5,
84  mesh_mapping_primitive = 6, // m_mapping_primitive is an ON_Mesh
85  srf_mapping_primitive = 7, // m_mapping_primitive is an ON_Surface
86  brep_mapping_primitive = 8 // m_mapping_primitive is an ON_Brep
87  };
88 
89  static ON_TextureMapping::TYPE TypeFromUnsigned(
90  unsigned int type_as_unsigned
91  );
92 
93  static const ON_wString TypeToString(
94  ON_TextureMapping::TYPE texture_mapping_type
95  );
96 
97  //////////////////////////////////////////////////////////
98  //
99  // Projection:
100  //
101  // When a mapping primitive, like a plane, sphere, box,
102  // or cylinder, is used, there are two projection options.
103  //
104  // clspt_projection: world xyz maps to the point on the
105  // mapping primitive that is closest to xyz.
106  // In this case, ON_TextureMapping::Evaluate
107  // ignores the vector argument.
108  //
109  // ray_projection: world xyz + world vector defines a world line.
110  // The world line is intersected with the mapping
111  // primitive and the intersection point that is
112  // closest to the world xyz point is used to
113  // calculate the mapping parameters.
114  //
115  // The value of m_projection can be changed as needed.
116  //
117  // If m_type = srfp_mapping, then m_projection is ignored.
118  //
119  enum class PROJECTION : unsigned int
120  {
121  no_projection = 0,
122  clspt_projection = 1,
123  ray_projection = 2
124  };
125 
126  static ON_TextureMapping::PROJECTION ProjectionFromUnsigned(
127  unsigned int projection_as_unsigned
128  );
129 
130  static const ON_wString ProjectionToString(
131  ON_TextureMapping::PROJECTION texture_mapping_projection
132  );
133 
134  //////////////////////////////////////////////////////////
135  //
136  // Texture space
137  //
138  // When a mapping primitive is a box or a capped cylinder,
139  // there are two options for the mapping. Either the sides
140  // all map to (0,1)x(0,1) (so the either texture map appears
141  // on each side, or the sides map to distinct regions of the
142  // texture space.
143  //
144  enum class TEXTURE_SPACE : unsigned int
145  {
146  single = 0, // sides and caps map to same texture space
147  divided = 1 // sides and caps map to distinct vertical
148  // regions of texture space.
149  // (0, 1/4, 2/4, 3/4, 1) for uncapped boxes.
150  // (0, 1/6, 2/6, 3/6, 4/6, 5/6, 1) for capped boxes.
151  // (0, 4/6, 5/6, 1) for capped cylinders.
152  };
153 
154  static ON_TextureMapping::TEXTURE_SPACE TextureSpaceFromUnsigned(
155  unsigned int texture_space_as_unsigned
156  );
157 
158  static const ON_wString SpaceToString(
159  ON_TextureMapping::TEXTURE_SPACE texture_mapping_space
160  );
161 
162 public:
163  ON_TextureMapping() ON_NOEXCEPT;
165  virtual ~ON_TextureMapping();
166  ON_TextureMapping& operator=(const ON_TextureMapping& src);
167 
168 private:
169  void Internal_CopyFrom(
170  const ON_TextureMapping& src
171  );
172 
173  void Internal_Destroy();
174 
175  bool Internal_WriteV5(
176  ON_BinaryArchive& binary_archive
177  ) const;
178 
179  bool Internal_ReadV5(
180  ON_BinaryArchive& binary_archive
181  );
182 
183 public:
184  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
185 
186  void Dump( ON_TextLog& ) const override;
187 
188  unsigned int SizeOf() const override;
189 
190  bool Write(
191  ON_BinaryArchive& binary_archive
192  ) const override;
193 
194  bool Read(
195  ON_BinaryArchive& binary_archive
196  ) override;
197 
198  /*
199  Determines whether the mapping, as currently set up, requires vertex normals to be present on the
200  mesh in order to evaluate the mapping correctly.
201  */
202  bool RequiresVertexNormals() const;
203  bool IsPeriodic(void) const;
204 
205  /*
206  Description:
207  Create a mapping that will convert surface parameters into
208  normalized (0,1)x(0,1) texture coordinates.
209  */
210  bool SetSurfaceParameterMapping(void);
211 
212  /*
213  Description:
214  Create a planar projection texture mapping.
215  Parameters:
216  plane - [in]
217  dx - [in] portion of the plane's x axis that is mapped to [0,1]
218  (can be a decreasing interval)
219  dy - [in] portion of the plane's x axis that is mapped to [0,1]
220  (can be a decreasing interval)
221  dz - [in] portion of the plane's x axis that is mapped to [0,1]
222  (can be a decreasing interval)
223  projection_method - [in]
224  1: Closest point mapping.
225  A target point P is mapped to the point on the plane
226  that is closest to P. The target normal is ignored.
227  2: Target line mapping. A target point-vector pair
228  (P, N), are mapped to the point on the plane
229  where the line through P, parallel to N, intersects
230  the plane. If the line is parallel to the plane,
231  the closest point mapping is used.
232  Example:
233  Create a mapping that maps the world axis aligned rectangle in
234  the world yz plane with corners at (0,3,5) and (0,7,19) to the
235  texture coordinate unit square.
236 
237  ON_3dVector plane_xaxis(0.0,1.0,0.0);
238  ON_3dVector plane_yaxis(0.0,0,0,1.0);
239  ON_3dPoint plane_origin(0.0,2.0,4.0);
240  ON_Plane plane(plane_origin,plane_xaxis,plane_yaxis);
241  ON_Interval dx( 0.0, 7.0 - 3.0);
242  ON_Interval dy( 0.0, 19.0 - 5.0);
243  ON_Interval dz( 0.0, 1.0 );
244  ON_TextureMapping mapping;
245  mapping.CreatePlaneMapping(plane,dx,dy,dz);
246 
247  Returns:
248  True if input is valid.
249  */
250  bool SetPlaneMapping(
251  const ON_Plane& plane,
252  const ON_Interval& dx,
253  const ON_Interval& dy,
254  const ON_Interval& dz
255  );
256 
257  /*
258  Description:
259  Create a cylindrical projection texture mapping.
260  Parameters:
261  cylinder - [in]
262  cylinder in world space used to define a cylindrical
263  coordinate system. The angular parameter maps (0,2pi)
264  to texture "u" (0,1), The height parameter maps
265  (height[0],height[1]) to texture "v" (0,1), and
266  the radial parameter maps (0,r) to texture "w" (0,1).
267  bIsCapped - [in]
268  If true, the cylinder is treated as a finite
269  capped cylinder.
270  Returns:
271  True if input is valid.
272  Remarks:
273  When the cylinder is capped and m_texture_space = divided,
274  the cylinder is mapped to texture space as follows:
275  The side is mapped to 0 <= "u" <= 2/3.
276  The bottom is mapped to 2/3 <= "u" <= 5/6.
277  The top is mapped to 5/6 <= "u" <= 5/6.
278  This is the same convention box mapping uses.
279  */
280  bool SetCylinderMapping(
281  const ON_Cylinder& cylinder,
282  bool bIsCapped
283  );
284 
285  /*
286  Description:
287  Create a spherical projection texture mapping.
288  Parameters:
289  sphere - [in]
290  sphere in world space used to define a spherical
291  coordinate system. The longitude parameter maps
292  (0,2pi) to texture "u" (0,1). The latitude paramter
293  maps (-pi/2,+pi/2) to texture "v" (0,1).
294  The radial parameter maps (0,r) to texture "w" (0,1).
295  Returns:
296  True if input is valid.
297  */
298  bool SetSphereMapping(
299  const ON_Sphere& sphere
300  );
301 
302  /*
303  Description:
304  Create a box projection texture mapping.
305  Parameters:
306  plane - [in]
307  The sides of the box the box are parallel to the
308  plane's coordinate planes. The dx, dy, dz intervals
309  determine the location of the sides.
310  dx - [in]
311  Determines the location of the front and back planes.
312  The vector plane.xaxis is perpendicular to these planes
313  and they pass through plane.PointAt(dx[0],0,0) and
314  plane.PointAt(dx[1],0,0), respectivly.
315  dy - [in]
316  Determines the location of the left and right planes.
317  The vector plane.yaxis is perpendicular to these planes
318  and they pass through plane.PointAt(0,dy[0],0) and
319  plane.PointAt(0,dy[1],0), respectivly.
320  dz - [in]
321  Determines the location of the top and bottom planes.
322  The vector plane.zaxis is perpendicular to these planes
323  and they pass through plane.PointAt(0,0,dz[0]) and
324  plane.PointAt(0,0,dz[1]), respectivly.
325  bIsCapped - [in]
326  If true, the box is treated as a finite
327  capped box.
328  Returns:
329  True if input is valid.
330  Remarks:
331  When m_texture_space = divided, the box is mapped to texture
332  space as follows:
333 
334  If the box is not capped, then each side maps to 1/4 of the texture map.
335 
336  v=1+---------+---------+---------+---------+
337  | x=dx[1] | y=dy[1] | x=dx[0] | y=dy[0] |
338  | Front | Right | Back | Left |
339  | --y-> | <-x-- | <-y-- | --x-> |
340  v=0+---------+---------+---------+---------+
341  0/4 <=u<= 1/4 <=u<= 2/4 <=u<= 3/4 <=u<= 4/4
342 
343  If the box is capped, then each side and cap gets 1/6 of the texture map.
344 
345  v=1+---------+---------+---------+---------+---------+---------+
346  | x=dx[1] | y=dy[1] | x=dx[0] | y=dy[0] | z=dx[1] | z=dz[0] |
347  | Front | Right | Back | Left | Top | Bottom |
348  | --y-> | <-x-- | <-y-- | --x-> | --x-> | --x-> |
349  v=0+---------+---------+---------+---------+---------+---------+
350  0/6 <=u<= 1/6 <=u<= 2/6 <=u<= 3/6 <=u<= 4/6 <=u<= 5/6 <=u<= 6/6
351  */
352  bool SetBoxMapping(
353  const ON_Plane& plane,
354  ON_Interval dx,
355  ON_Interval dy,
356  ON_Interval dz,
357  bool bIsCapped
358  );
359 
360  /*
361  Description:
362  Get plane mapping parameters from this texture mapping.
363  Parameters:
364  plane - [out]
365  dx - [out]
366  Portion of the plane's x axis that is mapped to [0,1]
367  dy - [out]
368  Portion of the plane's y axis that is mapped to [0,1]
369  dz - [out]
370  Portion of the plane's z axis that is mapped to [0,1]
371  Returns:
372  True if valid plane mapping parameters were returned.
373  Remarks:
374  NOTE WELL:
375  Generally, GetMappingPlane will not return the same
376  parameters passed to SetPlaneMapping. However, the
377  location of the plane will be the same.
378  */
379  bool GetMappingPlane(
380  ON_Plane& plane,
381  ON_Interval& dx,
382  ON_Interval& dy,
383  ON_Interval& dz
384  ) const;
385 
386  /*
387  Description:
388  Get a cylindrical projection parameters from this texture mapping.
389  Parameters:
390  cylinder - [out]
391  Returns:
392  True if a valid cylinder is returned.
393  Remarks:
394  Generally, GetMappingCylinder will not return the same
395  parameters passed to SetCylinderMapping. However, the
396  location of the cylinder will be the same.
397  If this mapping is not cylindrical, the cylinder will
398  approximate the actual mapping primitive.
399  */
400  bool GetMappingCylinder(
401  ON_Cylinder& cylinder
402  ) const;
403 
404  /*
405  Description:
406  Get a spherical projection parameters from this texture mapping.
407  Parameters:
408  sphere - [out]
409  Returns:
410  True if a valid sphere is returned.
411  Remarks:
412  Generally, GetMappingShere will not return the same
413  parameters passed to SetSphereMapping. However, the
414  location of the sphere will be the same.
415  If this mapping is not cylindrical, the cylinder will
416  approximate the actual mapping primitive.
417  */
418  bool GetMappingSphere(
419  ON_Sphere& sphere
420  ) const;
421 
422  /*
423  Get a box projection from the texture mapping.
424  Parameters:
425  plane - [out]
426  The center of the box is at plane.origin and the sides
427  of the box are parallel to the plane's coordinate planes.
428  dx - [out]
429  The "front" and "back" sides of the box are in spanned
430  by the vectors plane.yaxis and plane.zaxis. The back
431  plane contains the point plane.PointAt(dx[0],0,0) and
432  the front plane contains the point plane.PointAt(dx[1],0,0).
433  dy - [out]
434  The "left" and "right" sides of the box are in spanned
435  by the vectors plane.zaxis and plane.xaxis. The left
436  plane contains the point plane.PointAt(0,dx[0],0) and
437  the back plane contains the point plane.PointAt(0,dy[1],0).
438  dz - [out]
439  The "top" and "bottom" sides of the box are in spanned
440  by the vectors plane.xaxis and plane.yaxis. The bottom
441  plane contains the point plane.PointAt(0,0,dz[0]) and
442  the top plane contains the point plane.PointAt(0,0,dz[1]).
443  Returns:
444  True if a valid box is returned.
445  Remarks:
446  Generally, GetMappingBox will not return the same
447  parameters passed to SetBoxMapping. However, the
448  location of the box will be the same.
449  */
450  bool GetMappingBox(
451  ON_Plane& plane,
452  ON_Interval& dx,
453  ON_Interval& dy,
454  ON_Interval& dz
455  ) const;
456 
457 
458  /*
459  Description:
460  Reverses the texture in the specified direction.
461  Parameters:
462  dir - [in] 0 = reverse "u", 1 = reverse "v", 2 = reverse "w".
463  Remarks:
464  Modies m_uvw so that the spedified direction transforms
465  the texture coordinate t to 1-t.
466  Returns:
467  True if input is valid.
468  */
469  bool ReverseTextureCoordinate( int dir );
470 
471  /*
472  Description:
473  Swaps the specified texture coordinates.
474  Parameters:
475  i - [in]
476  j - [in]
477  Remarks:
478  Modifies m_uvw so that the specified texture coordinates are swapped.
479  Returns:
480  True if input is valid.
481  */
482  bool SwapTextureCoordinate( int i, int j );
483 
484  /*
485  Description:
486  Tiles the specified texture coordinates.
487  Parameters:
488  dir - [in] 0 = "u", 1 = "v", 2 = "w".
489  count - [in] number of tiles
490  offset - [in] offset of the tile
491  Remarks:
492  Modies m_uvw so that the specified texture coordinate is
493  tiled.
494  Returns:
495  True if input is valid.
496  */
497  bool TileTextureCoordinate( int dir, double count, double offset );
498 
499  /*
500  Description:
501  Evaluate the mapping to get a texture coordinate.
502  Parameters:
503  P - [in] Vertex location
504  N - [in] If the mapping projection is ray_projection,
505  then this is the vertex unit normal. Otherwise
506  N is ignored.
507  T - [out] Texture coordinate (u,v,w)
508 
509  P_xform -[in]
510  Transformation to be applied to P before performing
511  the mapping calculation.
512  N_xform - [in]
513  Transformation to be applied to N before performing
514  the mapping calculation. One way to calculate N_xform
515  is to use the call P_xform::GetVectorTransform(N_xform).
516 
517  Returns:
518  Nonzero if evaluation is successful. When the mapping
519  is a box or capped cylinder mapping, the value indicates
520  which side was evaluated.
521 
522  Cylinder mapping:
523  1 = cylinder wall, 2 = bottom cap, 3 = top cap
524  Box mapping:
525  1 = front
526  2 = right
527  3 = back
528  4 = left
529  5 = bottom
530  6 = top
531 
532  See Also:
533  ON_TextureMapping::GetTextureCoordinates
534  ON_Mesh::SetTextureCoordinates
535  */
536  virtual
537  int Evaluate(
538  const ON_3dPoint& P,
539  const ON_3dVector& N,
540  ON_3dPoint* T
541  ) const;
542 
543  virtual
544  int Evaluate(
545  const ON_3dPoint& P,
546  const ON_3dVector& N,
547  ON_3dPoint* T,
548  const ON_Xform& P_xform,
549  const ON_Xform& N_xform
550  ) const;
551 
552  int EvaluatePlaneMapping(
553  const ON_3dPoint& P,
554  const ON_3dVector& N,
555  ON_3dPoint* T
556  ) const;
557 
558  int EvaluateSphereMapping(
559  const ON_3dPoint& P,
560  const ON_3dVector& N,
561  ON_3dPoint* T
562  ) const;
563 
564  int EvaluateCylinderMapping(
565  const ON_3dPoint& P,
566  const ON_3dVector& N,
567  ON_3dPoint* T
568  ) const;
569 
570  int EvaluateBoxMapping(
571  const ON_3dPoint& P,
572  const ON_3dVector& N,
573  ON_3dPoint* T
574  ) const;
575 
576 
577  /*
578  Description:
579  Quickly check to see if a mesh or tag has texture coordinates
580  set by this mapping.
581  Parameters:
582  mesh - [in]
583  tag - [in]
584  object_xform - [in] (optional)
585  If this transform is not nullptr, then true will be
586  returned only if the mapping function is the same and
587  the tag's m_mesh_xform field is the same as mesh_xform.
588  This parameter is typically nullptr or the value of
589  ON_MappingRef::m_object_xform.
590  Returns:
591  True if the meshes texture coordinates were set by this
592  mapping.
593  */
594  bool HasMatchingTextureCoordinates(
595  const ON_Mesh& mesh,
596  const ON_Xform* object_xform = nullptr
597  ) const;
598 
599  bool HasMatchingTextureCoordinates(
600  const class ON_MappingTag& tag,
601  const ON_Xform* object_xform = nullptr
602  ) const;
603 
604  /*
605  Description:
606  Get texture coordinates. This calculation is
607  expensive. When possible, use a MappingMatch()
608  query to avoid unnecessary calculations.
609  Parameters:
610  mesh - [in]
611  T - [out] Texture coordinates returned here.
612  mesh_xform - [in] (optional)
613  If the mesh has been transformed since the texture mapping was set
614  up, pass the transformation here. Typically this is the value
615  of ON_Mesh::m_mapping_xform or ON_MappingRef::m_object_xform
616  bLazy - [in]
617  If true and the mesh.m_T[] values were calculated using
618  this mapping, they are simply copied to the T[] array
619  and no calculations are performed. If you are calling
620  the 3d point version and you care about the z-coordinate,
621  then do not use the lazy option (meshes only store
622  2d texture coordinates).
623  Tside - [out]
624  In the case of divided textures, side information is returned
625  here if a lazy mapping is not done. Otherwise Tside->Count()
626  will be zero.
627  Cylinder mapping:
628  1 = cylinder wall, 2 = bottom cap, 3 = top cap
629  Box mapping:
630  1 = front
631  2 = right
632  3 = back
633  4 = left
634  5 = bottom
635  6 = top
636  Example:
637 
638  ON_TextureMapping mapping = ...;
639  const ON_Mesh* mesh = ...;
640  bool bLazy = true;
641  ON_SimpleArray<ON_3dPoint> T(mesh->VertexCount());
642  T.SetCount(mesh->m_VertexCount());
643  if ( !mapping.GetTextureCoordinates(mesh,3,3,&T[0].x,bLazy) )
644  T.SetCount(0).
645 
646  Returns:
647  True if successful.
648  */
649  bool GetTextureCoordinates(
650  const ON_Mesh& mesh,
652  const ON_Xform* mesh_xform = 0,
653  bool bLazy = false,
654  ON_SimpleArray<int>* Tside = 0
655  ) const;
656 
657  bool GetTextureCoordinates(
658  const ON_Mesh& mesh,
660  const ON_Xform* mesh_xform = 0,
661  bool bLazy = false,
662  ON_SimpleArray<int>* Tside = 0
663  ) const;
664 
665 public:
666 
667 
668 public:
672 
673  // The m_bCapped applies to planar, cylinder and box mappings.
674  // If m_bCapped is false, the cylinder or box is "infinite", if m_bCapped is true, they are finite.
675  // In planar mappings, m_bCapped=false means "the Z texture coordinate will always be 0.0"
676  // this is now the default behaviour in Rhino 5.0 - it's what users expect apparently.
677  bool m_bCapped = false;
678 
679  //////////////////////////////////////////////////////////
680  //
681  // For primitive based mappings, these transformations are
682  // used to map the world coordinate (x,y,z) point P and
683  // surface normal N before it is projected to the normalized
684  // mapping primitive. The surface normal transformation,
685  // m_Nxyz, is always calculated from m_Pxyz. It is a
686  // runtime setting that is not saved in 3dm files.
687  // If m_type is srfp_mapping, then m_Pxyz and m_Nxyz are
688  // ignored.
691 
692  // Transform applied to mapping coordinate (u,v,w) to
693  // convert it into a texture coordinate.
696  ON__UINT32 MappingCRC() const;
697 
698  // Custom mapping primitive.
699  // Returns nullptr if no custom mapping primitive is stored in this texture mapping definition.
700  const ON_Object* CustomMappingPrimitive(void) const;
701 
702  //Returns a valid mesh if the custom mapping primitive is a mesh. Otherwise nullptr.
703  //Implementation is return ON_Mesh::Cast(CustomMappingPrimitive());
704  const ON_Mesh* CustomMappingMeshPrimitive(void) const;
705 
706  //Returns a valid brep if the custom mapping primitive is a brep. Otherwise nullptr.
707  //Implementation is return ON_Brep::Cast(CustomMappingPrimitive());
708  const ON_Brep* CustomMappingBrepPrimitive(void) const;
709 
710  //Returns a valid surface if the custom mapping primitive is a surface. Otherwise nullptr.
711  //Implementation is return ON_Surface::Cast(CustomMappingPrimitive());
712  const ON_Surface* CustomMappingSurfacePrimitive(void) const;
713 
714  void SetCustomMappingPrimitive(ON_Object*);
715 
716 private:
717 #pragma ON_PRAGMA_WARNING_PUSH
718 #pragma ON_PRAGMA_WARNING_DISABLE_MSC( 4251 )
719  // C4251: ... needs to have dll-interface to be used by clients of class ...
720  // m_mapping_primitive is private and all code that manages m_mapping_primitive is explicitly implemented in the DLL.
721 private:
722  std::shared_ptr<ON_Object> m_mapping_primitive = nullptr;
723 #pragma ON_PRAGMA_WARNING_POP
724 };
725 
726 #if defined(ON_DLL_TEMPLATE)
727 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_TextureMapping*>;
728 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<const ON_TextureMapping*>;
729 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_TextureMapping>;
730 #endif
731 
732 #endif
733 
Definition: opennurbs_brep.h:917
The ON_ModelComponent class is a base class for all components in a model and manages the index...
Definition: opennurbs_model_component.h:24
Definition: opennurbs_mesh.h:2123
TEXTURE_SPACE
Definition: opennurbs_texture_mapping.h:144
Definition: opennurbs_array.h:36
static const ON_TextureMapping SurfaceParameterTextureMapping
Definition: opennurbs_texture_mapping.h:47
TYPE
Definition: opennurbs_texture_mapping.h:75
static const ON_TextureMapping Unset
Definition: opennurbs_texture_mapping.h:43
ON_Cylinder is a right circular cylinder.
Definition: opennurbs_cylinder.h:27
ON_Object array is used to store lists of classes that are derived from ON_Object. It differs from ON_ClassArray in that the virtual ON_Object::MemoryRelocate function is called when growing the dynamic array requires changing the location of the memory buffer used to store the elements in the array.
Definition: opennurbs_array.h:725
Definition: opennurbs_string.h:2020
static const ON_Xform IdentityTransformation
ON_Xform IdentityTransformation diagonal = (1,1,1,1)
Definition: opennurbs_xform.h:32
PROJECTION
Definition: opennurbs_texture_mapping.h:119
Definition: opennurbs_xform.h:28
Definition: opennurbs_mesh.h:2188
Definition: opennurbs_texture_mapping.h:37
Definition: opennurbs_line.h:20
Definition: opennurbs_brep.h:1472
Pure virtual base class for all classes that must provide runtime class id or support object level 3D...
Definition: opennurbs_object.h:460
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
Definition: opennurbs_model_component.h:1622
Definition: opennurbs_point.h:460
Definition: opennurbs_plane.h:20
Definition: opennurbs_surface.h:57
Definition: opennurbs_point.h:1152
Definition: opennurbs_point.h:46
Definition: opennurbs_sphere.h:22