Commit Graph

69 Commits

Author SHA1 Message Date
George ElKoura
92341f7c1e Prefix OpenSubdiv CMake macros
This fixes issue #1157 by adding "osd" as a prefix to public macros.
2019-08-17 16:44:30 -07:00
David G Yu
4160a248da Removed accidentally committed .swp file 2019-06-21 10:52:46 -07:00
David G Yu
7dbcee64e6 Fixed int to bool conversion warning 2019-06-21 10:50:50 -07:00
David G Yu
dc22a0cb1d Updated mtlViewer command line arguments
Updated the mtlViewer to make use of common/argOptions.h
like the other viewers and also implemented a "fit to frame"
hotkey. Both changes help improve manual testing.
2019-06-18 14:27:33 -07:00
David G Yu
58a71672a7 Update glFVarViewer option defaults
Enabled smooth corner, inf sharp and single crease patch
options by default.
2019-06-18 10:28:54 -07:00
David G Yu
5d33f7c28e Improved glFVarViewer shaders for Loop
Removed the use of the LOOP preprocessor symbol from
the glFVarViewer shaders code. The shader code is now
configured according to the types of the resulting patches
without depending on the subdivision scheme of the mesh
topology.

This allows the implementation of face-varying interpolation
to be improved and simplifies both the shader code and
application code.

Also, fixed a couple of incorrect buffer/texture bindings
that were raising GL errors.
2019-06-17 17:59:15 -07:00
barry
4a198ace66 Added new Loop tetrahedron shape to main example viewers:
- added to the main geometry viewers: glViewer, dxViewer, mtlViewer
    - added to glFVarViewer for viewing face-varying UVs
2019-06-14 15:24:00 -07:00
barry
347eb033d5 Update shape list for examples/glFVarViewer:
- included shapes added in recent pull requests
    - removed redundant shapes
2019-06-05 16:16:45 -07:00
barry
239eb28fcd Minor improvements to examples/glFVarViewer:
- added checkboxes for Control Edges and Vertices as used elsewhere
    - added checkbox for UV Backface Culling specific to this example
    - relabeled the Boundaries pulldown to Linear Interpolation
    - renamed variables in source to better reflect the affected enum
2019-05-15 15:22:18 -07:00
barry
b7470bb26f Moved definition of struct ShapeDesc into same header file as Shape:
- added definition to regression/common/shape_utils.h
    - removed examples/common/shapeDesc.h and all references to it
    - removed local definitions of ShapeDesc from examples, regressions, etc.
    - overloaded Shape::parseObj() with ShapeDesc
    - updated examples to use Shape::parseObj(ShapeDesc const&);
    - removed axis argument to Shape::ParseObj() and ObjAnim::Create()
2019-04-23 12:05:14 -07:00
barry
48a557abeb Replaced -axis with -yup in common args and examples:
- replaced -axis with -yup in examples/common/argOptions
    - updated clients of ArgOptions: glViewer, glFVarViewer, dxViewer
    - updated documentation for common arguments and usage of examples
2019-04-16 18:59:24 -07:00
George ElKoura
61f5ceabde Factored viewer args parsing for into common place
Started refactoring how we parse arguments for sample viewer
applications into a common place.  This will make it easier
to keep args consistent between applications.
2019-04-08 17:59:46 -07:00
barry
aa46fd3d6d Added UI options to examples/glFVarViewer consistent with glViewer:
- added the smooth corner, single crease and inf-sharp patch options
    - added a missing shape illustrating inf-sharp patches
2019-02-06 18:45:02 -08:00
barry
5595255858 Several minor updates to the GL examples:
- addition of new shapes -- mainly Loop and Bilinear
    - removal of redundant shapes and those not suited to a particular example
    - enforced consistent "Patch Type" coloring where provided
    - enforced consistent command line usage for common options and Obj input
    - enforced consistent default settings on initialization
    - added errors and/or assertions where legitimate limitations remain
    - improved error handling (OSD errors not being flushed before termination)
2019-02-05 17:22:10 -08:00
barry
20dcd24b9d Updated all example source for consistent inclusion of header files:
- prepend the opensubdiv directory to all library headers included
    - removed the opensubdiv directory from all declared include paths
2019-01-31 10:49:02 -08:00
David G Yu
06f4a60939 Updated glViewer and glFVarViewer for Loop patches
- Removed Catmark restrictions in the application code and shaders
- Added command line options to specifiy the Scheme for .obj input files
- Added support for Linear end-cap approximation
- Updated GUI labels for end-cap types, i.e. "Linear" instead of "Bilinear"
  and "Regular" instead of "BSpline".
- Added new shading color to glViewer for "Patch Depth"
- Disabled screen-space and fractional tessellation by default
2019-01-18 18:20:21 -08:00
David G Yu
ff34c514f5 Improved patch basis eval for Osd to match Far
This updates the patch basis evaluation functions in Osd
to match recent changes to far/patchBasis.

This also exposes a common facility for dealing with PatchCoord,
PatchArray, and PatchParam. These are exposed as global functions
operating on struct data, since C++ style class methods are not
supported by all of the Osd shader and kernel execution envirionments.

Changes:
    - Merged far/patchBasis.cpp to osd/patchBasisCommon{,Types,Eval}.h
    - Exposed PatchCoord, PatchArray, and PatchParam to Osd kernels
    - exposed OsdEvaluatePatchBasis and OsdEvaluatePatchBasisNormalized
    - Updated CPU, TBB, Omp, CUDA, OpenCL, GLSL, HLSL, and Metal evaluators
    - Updated glFVarViewer
2018-11-15 17:11:50 -08:00
barry
c424594625 Major step towards consistent use of include paths in source files:
- changed the main OPENSUBDIV_INCLUDE_DIR to exclude ./opensubdiv
    - updated CMakeLists.txt files in non-examples to use only this path
    - updated CMakeLists.txt files in examples to append ./opensubdiv to path
    - updated source in regression/common to use #include <opensubdiv/...>
    - updated source in examples/common to use #include <opensubdiv/...>
    - deferred source in examples to be updated on a case-by-case basis
2018-10-09 10:51:31 -07:00
barry
7b2a0b239d minor improvements to examples/glFVarViewer:
- added detection of shapes without UVs and report fatal error
    - fixed command line parsing of shape file arguments and other options
    - added missing UVs from shapes/catmark_fan
2017-01-27 14:22:54 -08:00
Mike Erwin
bd3113e7e3 spelling phase 4 -- examples, tutorials, regression tests
Read all comments and made corrections to files that aren't part of
OpenSubdiv itself but are packaged with it.

Commandline output of glPtexViewer is affected. Otherwise no functional
changes.
2017-01-24 22:48:48 -08:00
barry
796a2f40a7 Fixed bug with non-manifold face-varying topology causing crash:
- corrected the regular patch assembly in Far::PatchTableFactory
    - updated regression shapes to include the problematic topology
2016-12-15 12:33:36 -08:00
David G Yu
0a9b1f6373 Updated glFVarViewer/glEvalLimit for FVar stencils
These viewers now use stencil tables to refine all
face-varying primvar values, i.e. for both refined
points and local points.
2016-11-22 20:05:42 -08:00
David G Yu
552e308266 Added OsdGetPatchIsRegular() for GLSL and HLSL 2016-10-17 15:25:17 -07:00
David G Yu
5ad64bc33e Addressed some FVar PatchTable API review notes
Fixed some inconsistencies with the methods added
to support face-varying patches.
2016-10-14 20:11:17 -07:00
barry
e21b4d902f Added a few more test shapes for face-varying and inf-sharp patches:
- added new shapes to regression/shapes
    - updated shapes/all.h to include them
    - updated init_shapes.h for glViewer and glFVarViewer
2016-10-13 19:59:38 -07:00
David G Yu
df5d01ad3c Fixed naming inconsistencies in Far::PatchTable
The methods which return arrays of FVarPatchParam have
been made plural, e.g. GetFVarPatchParams(), for consistency
with the other methods in PatchTable.

Also fixed a missing doxygen tag.
2016-10-11 17:07:14 -07:00
David G. Yu
42f5090290 Updated glFVarViewer and glEvalLimit examples
These have both been updated to test the refinement
and evaluation of face-varying patch data.
2016-09-29 10:00:19 -07:00
Thomas Thomassen
72610a3043 Glean up GLEW and GLFW. 2016-06-25 10:29:59 +02:00
George ElKoura
923d60ca74 Use cmake's folder feature on platforms that support it.
We now make use of folders where they are supported.  In particular, on Visual Studio, this produces much nicer solutions to navigate.
2016-06-09 17:04:26 -07:00
George ElKoura
effe6a2ed6 Fixed small bug in glFVarViewer for Loop.
- Make sure to pass in the LOOP define to the shader when dealing with
Loop surfaces.
2015-08-24 17:33:30 -07:00
Takahito Tejima
36465ed96c Merge pull request #586 from davidgyu/fvarRename
Renamed per-patch face-varying access methods
2015-06-02 14:26:25 -07:00
David G Yu
0243f54b29 Updated patch table face-varying interface
Now the channel specifier is the last parameter in a method's
parameter list with a default of 0.  This is consistent with the
topological face-varying queries and also simplifies the common
case of just a single face-varying channel.
2015-06-02 13:51:32 -07:00
David G Yu
385df434ec Renamed per-patch face-varying access methods
This matches more closely the pattern used elsewhere in Far:
    GetFVarPatchValues() --> GetPatchFVarValues()
    GetFVarPatchesValues() --> GetFVarValues()
2015-06-02 09:13:17 -07:00
David G Yu
89468a40b6 Fixed face varying shading for examples.
Renamed the shader define used by the glViewer and glFVarViewer to
make the intended use more clear and robust.
2015-06-02 08:49:11 -07:00
Takahito Tejima
85bb0a156e examples cleanup: remove framebuffer class
- the framebuffer class in examples/common is unstable in certain drivers.
removing offscreen rendering for now.
- move screenshot function to GLUtils.
- fix vertex attrib binding bug (not showing control mesh on osx)
2015-05-31 20:52:20 -07:00
Takahito Tejima
7394bf5f51 Examples cleanup: factor out control mesh drawing.
- add GLControlMeshDisplay and D3D11ControlMeshDisplay into
  examples/common
- delete all drawCageEdges/drawCageVertices from viewers and
  use ControlMeshDisplay class
2015-05-31 15:08:37 -07:00
George ElKoura
5a51f31104 Remove mention of vtr from tests and examples.
- Renamed common/vtr_utils to common/far_utils.
- Renamed all mentions of Vtr in the sources of tests and examples.
2015-05-30 22:10:07 -07:00
Takahito Tejima
997d6035b9 Merge pull request #558 from davidgyu/fvarFix
Fixed a couple of problems with FVar handling
2015-05-30 12:00:32 -07:00
David G Yu
cd782e3728 Fixed a couple of problems with the FVar handling
This fixes a couple of minor regressions with linear FVar
display in the glViewer and glFVarViewer.
2015-05-29 23:58:40 -07:00
Jeremy Cowles
261dc17f1b OpenGL init without errors, example cleanup
The GLFW context version hint is a minimum version, not maximum version so
requesting 4.4 and then falling back to lower versions doesn't make sense.

This change sets the minimum version to 3.2 and attempts to standardize this
across all example apps.

Also print the maximum supported GL version along with the context version
at startup.
2015-05-29 22:37:12 -07:00
Takahito Tejima
89dcea57c2 Fix CMakeLists: make project-relative include path overridable
All examples, regression tests and tutorials directly looked into
opensubdiv source directory to grab the header files. This is somewhat
convenient during development but they can mistakenly access private
header files.

With this change, when OPENSUBDIV_INCLUDE_DIR is given to cmake,
it will be used as an include search path to build examples etc.
Otherwise it follows the same behavior as before.

Also replaces include references to the files in regression dir
to be relative, and cleanups some copy-paste patterns.
2015-05-28 17:32:33 -07:00
David G Yu
de286e07a6 Fixed allocation of texture buffers resources 2015-05-27 15:23:26 -07:00
Takahito Tejima
541aeddd3a Osd API refactor: EvalStencils and EvalPatches
Add EvalStencils and EvalPatches API for most of CPU and GPU evaluators.

with this change, Eval API in the osd layer consists of following parts:

- Evaluators (Cpu, Omp, Tbb, Cuda, CL, GLXFB, GLCompute, D3D11Compute)
  implements EvalStencils and EvalPatches(*). Both supports derivatives
  (not fully implemented though)

- Interop vertex buffer classes (optional, same as before)
  Note that these classes are not necessary to use Evaluators.
  All evaluators have EvalStencils/Patches which take device-specific
  buffer objects. For example, GLXFBEvaluator can take GLuint directly
  for both stencil tables and input primvars. Although using these
  interop classes makes it easy to integrate osd into relatively
  simple applications.

- device-dependent StencilTable and PatchTable (optional)
  These are also optional, but can be used simply a substitute of
  Far::StencilTable and Far::PatchTable for osd evaluators.

- PatchArray, PatchCoord, PatchParam
  They are tiny structs used for GPU based patch evaluation.

(*) TODO and known issues:
- CLEvaluator and D3D11Evaluator's EvalPatches() have not been implemented.
- GPU Gregory patch evaluation has not been implemented in EvalPatches().
- CudaEvaluator::EvalPatches() is very unstable.
- All patch evaluation kernels have not been well optimized.
- Currently GLXFB kernel doesn't support derivative evaluation.
   There's a technical difficulty for the multi-stream output.
2015-05-25 22:43:43 -07:00
Takahito Tejima
a7c5179ef9 renaming (2/2) PatchTables and StencilTables to PatchTable and StencilTable
replace all occurrences reffering PatchTables, StencilTables, and their factories.
2015-05-22 11:50:01 -07:00
barfowl
fd89a1323e Fixed issue with examples/glFVarViewer 2015-05-21 20:33:02 -07:00
barfowl
6d5b29c2dc Replacing use of old Far::TopologyRefiner methods with Far::TopologyLevel 2015-05-21 19:52:25 -07:00
Takahito Tejima
109a3f5383 osd layer: Add GLPatchTable and retire DrawContext
In osd layer, we use GLPatchTable (D3D11PatchTable) as a
device-specific representation of FarPatchTables instead of
DrawContext. GLPatchTable may be used not only for drawing
but also for GPU eval APIs (not yet supported though.
We may add CudaPatchTable etc as needed).

The legacy gregory patch drawing buffers are carved out to
the separate class, named GLLegacyGregoryPatchTable.

Also face-varying data are split into client side for now, until
we add new and more robust face-varying drawing structure
(scheduled at 3.1 release)

Tentatively replicate PatchArray structure in GLPatchTables. It will
be revised in the upcoming change.

Shifting hard-coded SRV locations of legacy gregory buffers in HLSL shaders.
2015-05-20 15:55:06 -07:00
Takahito Tejima
c3aa00e706 remove SupportsAdaptiveTessellation from OsdDrawContext, and example cleanups
As a preparation for retiring DrawContext, move SupportsAdaptiveTessellation
method to examples/common/glUtils, which is renamed and namespaced
from gl_common.{cpp,h} to be consistent to other files.
Same renamings applied to other example files.
2015-05-19 10:30:16 -07:00
Takahito Tejima
4a4322983f Osd drawing API refactoring.
Remove DrawRegistry from osd layer and put a simple shader caching
utility into examples/common. osd layer only provides patch shader
snippet and let client configure and compile the code. Clients also
maintain the lifetime of shader object, which is preferable for the
actual application integration.

update all examples to use the new scheme.
2015-05-13 17:35:46 -07:00
Takahito Tejima
b66380ee52 Refactor Osd::DrawContext
Since unified shading work already removed subPatch info from
Osd::PatchDescriptor, the difference between Far::PatchDescriptor and
Osd::PatchDescriptor is just maxValence and numElements. They are used
for legacy gregory patch drawing.

Both maxValence and numElements are actually constant within a topology
(drawContext). This change move maxValence to DrawContext and let client
manage numElements, then we can eliminate Osd::PatchDescriptor and simply
use Far::PatchDescritor instead.

This is still an intermediate step toward further DrawRegistry refactoring.
For the time being, adding EffectDesc struct to include maxValence and
numValence to be maintained by the clients. They will be cleaned up later.

The side benefit of this change is we no longer need to recompile regular b-spline
shaders for the different max-valences.
2015-05-11 18:06:46 -07:00