mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-23 20:20:09 +00:00
Merge pull request #1056 from barfowl/examples_gl
Several minor updates to the GL examples
This commit is contained in:
commit
f83adf942e
@ -131,9 +131,9 @@ std::vector<float> g_orgPositions,
|
|||||||
|
|
||||||
int g_currentShape = 0,
|
int g_currentShape = 0,
|
||||||
g_adaptive = 1,
|
g_adaptive = 1,
|
||||||
g_level = 3,
|
g_level = 2,
|
||||||
g_kernel = kCPU,
|
g_kernel = kCPU,
|
||||||
g_endCap = kEndCapBSplineBasis,
|
g_endCap = kEndCapGregoryBasis,
|
||||||
g_infSharpPatch = 0,
|
g_infSharpPatch = 0,
|
||||||
g_numElements = 3;
|
g_numElements = 3;
|
||||||
|
|
||||||
@ -1223,8 +1223,8 @@ keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
||||||
printf("Error: %d\n", err);
|
printf("OpenSubdiv Error: %d\n", err);
|
||||||
printf("%s", message);
|
printf(" %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1382,10 +1382,10 @@ initHUD() {
|
|||||||
|
|
||||||
int endcap_pulldown = g_hud.AddPullDown("End cap (E)", 10, 150, 200,
|
int endcap_pulldown = g_hud.AddPullDown("End cap (E)", 10, 150, 200,
|
||||||
callbackEndCap, 'e');
|
callbackEndCap, 'e');
|
||||||
g_hud.AddPullDownButton(endcap_pulldown, "BSpline",
|
g_hud.AddPullDownButton(endcap_pulldown, "Regular",
|
||||||
kEndCapBSplineBasis,
|
kEndCapBSplineBasis,
|
||||||
g_endCap == kEndCapBSplineBasis);
|
g_endCap == kEndCapBSplineBasis);
|
||||||
g_hud.AddPullDownButton(endcap_pulldown, "GregoryBasis",
|
g_hud.AddPullDownButton(endcap_pulldown, "Gregory",
|
||||||
kEndCapGregoryBasis,
|
kEndCapGregoryBasis,
|
||||||
g_endCap == kEndCapGregoryBasis);
|
g_endCap == kEndCapGregoryBasis);
|
||||||
|
|
||||||
@ -1442,36 +1442,39 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
Scheme defaultScheme = kCatmark;
|
Scheme defaultScheme = kCatmark;
|
||||||
std::string str;
|
std::vector<char const *> objfiles;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "-u")) {
|
if (strstr(argv[i], ".obj")) {
|
||||||
|
objfiles.push_back(argv[i]);
|
||||||
|
} else if (!strcmp(argv[i], "-a")) {
|
||||||
|
g_adaptive = true;
|
||||||
|
} else if (!strcmp(argv[i], "-u")) {
|
||||||
g_adaptive = false;
|
g_adaptive = false;
|
||||||
}
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
else if (!strcmp(argv[i], "-d")) {
|
|
||||||
if (++i < argc) g_level = atoi(argv[i]);
|
if (++i < argc) g_level = atoi(argv[i]);
|
||||||
}
|
} else if (!strcmp(argv[i], "-f")) {
|
||||||
else if (!strcmp(argv[i], "-f")) {
|
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
}
|
} else if (!strcmp(argv[i], "-bilinear")) {
|
||||||
else if (!strcmp(argv[i], "-bilinear")) {
|
|
||||||
defaultScheme = kBilinear;
|
defaultScheme = kBilinear;
|
||||||
}
|
} else if (!strcmp(argv[i], "-catmark")) {
|
||||||
else if (!strcmp(argv[i], "-catmark")) {
|
|
||||||
defaultScheme = kCatmark;
|
defaultScheme = kCatmark;
|
||||||
}
|
} else if (!strcmp(argv[i], "-loop")) {
|
||||||
else if (!strcmp(argv[i], "-loop")) {
|
|
||||||
defaultScheme = kLoop;
|
defaultScheme = kLoop;
|
||||||
|
} else {
|
||||||
|
printf("Warning: unrecognized argument '%s' ignored\n", argv[i]);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
std::ifstream ifs(argv[i]);
|
for (int i = 0; i < (int)objfiles.size(); ++i) {
|
||||||
if (ifs) {
|
std::ifstream ifs(objfiles[i]);
|
||||||
std::stringstream ss;
|
if (ifs) {
|
||||||
ss << ifs.rdbuf();
|
std::stringstream ss;
|
||||||
ifs.close();
|
ss << ifs.rdbuf();
|
||||||
str = ss.str();
|
ifs.close();
|
||||||
g_defaultShapes.push_back(ShapeDesc(argv[i], str.c_str(), defaultScheme));
|
std::string str = ss.str();
|
||||||
}
|
g_defaultShapes.push_back(ShapeDesc(objfiles[i], str.c_str(), defaultScheme));
|
||||||
|
} else {
|
||||||
|
printf("Warning: cannot open shape file '%s'\n", objfiles[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ static std::vector<ShapeDesc> g_defaultShapes;
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void initShapes() {
|
static void initShapes() {
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -48,22 +49,14 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_single_crease", catmark_single_crease, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_single_crease", catmark_single_crease, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease0", catmark_inf_crease0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease0", catmark_inf_crease0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );
|
||||||
@ -81,16 +74,29 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit0", catmark_square_hedit0, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit1", catmark_square_hedit1, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit2", catmark_square_hedit2, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit3", catmark_square_hedit3, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_pole8", loop_pole8, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_pole64", loop_pole64, kLoop ) );
|
||||||
|
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear ) );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -79,7 +79,7 @@ OpenSubdiv::Sdc::Options::FVarLinearInterpolation g_fvarBoundary =
|
|||||||
int g_fullscreen = 0,
|
int g_fullscreen = 0,
|
||||||
g_freeze = 0,
|
g_freeze = 0,
|
||||||
g_displayStyle = kWireShaded,
|
g_displayStyle = kWireShaded,
|
||||||
g_adaptive = 0,
|
g_adaptive = 1,
|
||||||
g_mbutton[3] = {0, 0, 0},
|
g_mbutton[3] = {0, 0, 0},
|
||||||
g_mouseUvView = 0,
|
g_mouseUvView = 0,
|
||||||
g_running = 1;
|
g_running = 1;
|
||||||
@ -1140,7 +1140,7 @@ initHUD() {
|
|||||||
g_hud.AddPullDownButton(endcap_pulldown, "Regular",
|
g_hud.AddPullDownButton(endcap_pulldown, "Regular",
|
||||||
kEndCapBSplineBasis,
|
kEndCapBSplineBasis,
|
||||||
g_endCap == kEndCapBSplineBasis);
|
g_endCap == kEndCapBSplineBasis);
|
||||||
g_hud.AddPullDownButton(endcap_pulldown, "GregoryBasis",
|
g_hud.AddPullDownButton(endcap_pulldown, "Gregory",
|
||||||
kEndCapGregoryBasis,
|
kEndCapGregoryBasis,
|
||||||
g_endCap == kEndCapGregoryBasis);
|
g_endCap == kEndCapGregoryBasis);
|
||||||
|
|
||||||
@ -1206,8 +1206,8 @@ idle() {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
||||||
printf("Error: %d\n", err);
|
printf("OpenSubdiv Error: %d\n", err);
|
||||||
printf("%s", message);
|
printf(" %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1233,10 +1233,16 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
Scheme defaultScheme = kCatmark;
|
Scheme defaultScheme = kCatmark;
|
||||||
std::string str;
|
std::vector<char const *> objfiles;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "-d")) {
|
if (strstr(argv[i], ".obj")) {
|
||||||
|
objfiles.push_back(argv[i]);
|
||||||
|
} else if (!strcmp(argv[i], "-a")) {
|
||||||
|
g_adaptive = true;
|
||||||
|
} else if (!strcmp(argv[i], "-u")) {
|
||||||
|
g_adaptive = false;
|
||||||
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
if (++i < argc) g_level = parseIntArg(argv[i], g_level);
|
if (++i < argc) g_level = parseIntArg(argv[i], g_level);
|
||||||
} else if (!strcmp(argv[i], "-c")) {
|
} else if (!strcmp(argv[i], "-c")) {
|
||||||
if (++i < argc) g_repeatCount = parseIntArg(argv[i], g_repeatCount);
|
if (++i < argc) g_repeatCount = parseIntArg(argv[i], g_repeatCount);
|
||||||
@ -1248,19 +1254,20 @@ int main(int argc, char ** argv) {
|
|||||||
defaultScheme = kCatmark;
|
defaultScheme = kCatmark;
|
||||||
} else if (!strcmp(argv[i], "-loop")) {
|
} else if (!strcmp(argv[i], "-loop")) {
|
||||||
defaultScheme = kLoop;
|
defaultScheme = kLoop;
|
||||||
} else if (argv[i][0] == '-') {
|
|
||||||
printf("Warning: unrecognized option '%s' ignored\n", argv[i]);
|
|
||||||
} else {
|
} else {
|
||||||
std::ifstream ifs(argv[i]);
|
printf("Warning: unrecognized argument '%s' ignored\n", argv[i]);
|
||||||
if (ifs) {
|
}
|
||||||
std::stringstream ss;
|
}
|
||||||
ss << ifs.rdbuf();
|
for (int i = 0; i < (int)objfiles.size(); ++i) {
|
||||||
ifs.close();
|
std::ifstream ifs(objfiles[i]);
|
||||||
str = ss.str();
|
if (ifs) {
|
||||||
g_defaultShapes.push_back(ShapeDesc(argv[i], str.c_str(), defaultScheme));
|
std::stringstream ss;
|
||||||
} else {
|
ss << ifs.rdbuf();
|
||||||
printf("Warning: cannot open shape file '%s'\n", argv[i]);
|
ifs.close();
|
||||||
}
|
std::string str = ss.str();
|
||||||
|
g_defaultShapes.push_back(ShapeDesc(objfiles[i], str.c_str(), defaultScheme));
|
||||||
|
} else {
|
||||||
|
printf("Warning: cannot open shape file '%s'\n", objfiles[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ static void initShapes() {
|
|||||||
// Note that any shapes added here must have UVs -- loading a shape without UVs is a fatal
|
// Note that any shapes added here must have UVs -- loading a shape without UVs is a fatal
|
||||||
// error and will result in termination when it is selected.
|
// error and will result in termination when it is selected.
|
||||||
//
|
//
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -51,16 +52,12 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner4", catmark_cube_corner4, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner4", catmark_cube_corner4, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
||||||
@ -84,27 +81,26 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit0", catmark_square_hedit0, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit1", catmark_square_hedit1, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit2", catmark_square_hedit2, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit3", catmark_square_hedit3, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgecorner", loop_saddle_edgecorner, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgeonly", loop_saddle_edgeonly, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_fvar_bound0", loop_fvar_bound0, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_fvar_bound1", loop_fvar_bound1, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_fvar_bound2", loop_fvar_bound2, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_fvar_bound3", loop_fvar_bound3, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
|
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear ) );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -104,6 +104,24 @@ public:
|
|||||||
ss << "#define PRIM_TRI\n";
|
ss << "#define PRIM_TRI\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// need for patch color-coding : we need these defines in the fragment shader
|
||||||
|
if (type == Far::PatchDescriptor::GREGORY) {
|
||||||
|
ss << "#define OSD_PATCH_GREGORY\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::GREGORY_BOUNDARY) {
|
||||||
|
ss << "#define OSD_PATCH_GREGORY_BOUNDARY\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::GREGORY_BASIS) {
|
||||||
|
ss << "#define OSD_PATCH_GREGORY_BASIS\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::LOOP) {
|
||||||
|
ss << "#define OSD_PATCH_LOOP\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
|
||||||
|
ss << "#define OSD_PATCH_GREGORY_TRIANGLE\n";
|
||||||
|
}
|
||||||
|
if (type == Far::PatchDescriptor::TRIANGLES ||
|
||||||
|
type == Far::PatchDescriptor::LOOP ||
|
||||||
|
type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
|
||||||
|
ss << "#define LOOP\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (desc.IsAdaptive()) {
|
if (desc.IsAdaptive()) {
|
||||||
ss << "#define SMOOTH_NORMALS\n";
|
ss << "#define SMOOTH_NORMALS\n";
|
||||||
}
|
}
|
||||||
@ -295,13 +313,11 @@ void runTest(ShapeDesc const &shapeDesc, std::string const &kernel,
|
|||||||
*shape,
|
*shape,
|
||||||
Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||||
|
|
||||||
// Adaptive refinement currently supported only for catmull-clark scheme
|
|
||||||
bool doAdaptive = adaptive && (shapeDesc.scheme == kCatmark);
|
|
||||||
bool interleaveVarying = true;
|
bool interleaveVarying = true;
|
||||||
bool doSingleCreasePatch = true;
|
bool doSingleCreasePatch = true;
|
||||||
|
|
||||||
Osd::MeshBitset bits;
|
Osd::MeshBitset bits;
|
||||||
bits.set(Osd::MeshAdaptive, doAdaptive);
|
bits.set(Osd::MeshAdaptive, adaptive);
|
||||||
bits.set(Osd::MeshUseSingleCreasePatch, doSingleCreasePatch);
|
bits.set(Osd::MeshUseSingleCreasePatch, doSingleCreasePatch);
|
||||||
bits.set(Osd::MeshInterleaveVarying, interleaveVarying);
|
bits.set(Osd::MeshInterleaveVarying, interleaveVarying);
|
||||||
bits.set(Osd::MeshFVarData, false);
|
bits.set(Osd::MeshFVarData, false);
|
||||||
@ -445,7 +461,8 @@ void runTest(ShapeDesc const &shapeDesc, std::string const &kernel,
|
|||||||
static void usage(const char *program) {
|
static void usage(const char *program) {
|
||||||
std::cout
|
std::cout
|
||||||
<< "Usage %s : " << program << "\n"
|
<< "Usage %s : " << program << "\n"
|
||||||
<< " -a : adaptive refinement\n"
|
<< " -a : adaptive refinement (default)\n"
|
||||||
|
<< " -u : uniform refinement\n"
|
||||||
<< " -l <isolation level> : isolation level (default = 2)\n"
|
<< " -l <isolation level> : isolation level (default = 2)\n"
|
||||||
<< " -t <tess level> : tessellation level (default = 1)\n"
|
<< " -t <tess level> : tessellation level (default = 1)\n"
|
||||||
<< " -w <prefix> : write images to PNG as\n"
|
<< " -w <prefix> : write images to PNG as\n"
|
||||||
@ -464,7 +481,7 @@ int main(int argc, char ** argv) {
|
|||||||
int tessLevel = 1;
|
int tessLevel = 1;
|
||||||
int isolationLevel = 2;
|
int isolationLevel = 2;
|
||||||
bool writeToFile = false;
|
bool writeToFile = false;
|
||||||
bool adaptive = false;
|
bool adaptive = true;
|
||||||
std::string prefix;
|
std::string prefix;
|
||||||
std::string displayMode = "PATCH_TYPE";
|
std::string displayMode = "PATCH_TYPE";
|
||||||
std::vector<std::string> kernels;
|
std::vector<std::string> kernels;
|
||||||
@ -472,6 +489,8 @@ int main(int argc, char ** argv) {
|
|||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "-a")) {
|
if (!strcmp(argv[i], "-a")) {
|
||||||
adaptive = true;
|
adaptive = true;
|
||||||
|
} else if (!strcmp(argv[i], "-u")) {
|
||||||
|
adaptive = false;
|
||||||
} else if (!strcmp(argv[i], "-l")) {
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
isolationLevel = atoi(argv[++i]);
|
isolationLevel = atoi(argv[++i]);
|
||||||
} else if (!strcmp(argv[i], "-k")) {
|
} else if (!strcmp(argv[i], "-k")) {
|
||||||
|
@ -40,6 +40,7 @@ static std::vector<ShapeDesc> g_shapes;
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void initShapes() {
|
static void initShapes() {
|
||||||
|
|
||||||
|
g_shapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -48,17 +49,15 @@ static void initShapes() {
|
|||||||
g_shapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_shapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_shapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_shapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
||||||
@ -90,17 +89,29 @@ static void initShapes() {
|
|||||||
g_shapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
||||||
g_shapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
g_shapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
||||||
|
|
||||||
g_shapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
|
||||||
|
|
||||||
g_shapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) );
|
|
||||||
g_shapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) );
|
|
||||||
g_shapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_saddle_edgecorner", loop_saddle_edgecorner, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_saddle_edgeonly", loop_saddle_edgeonly, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_fvar_bound0", loop_fvar_bound0, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_fvar_bound1", loop_fvar_bound1, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_fvar_bound2", loop_fvar_bound2, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_fvar_bound3", loop_fvar_bound3, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
||||||
g_shapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
g_shapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_pole8", loop_pole8, kLoop ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("loop_pole64", loop_pole64, kLoop ) );
|
||||||
|
|
||||||
|
g_shapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear ) );
|
||||||
|
g_shapes.push_back( ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear ) );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -320,11 +320,11 @@ getAdaptivePatchColor(ivec3 patchParam)
|
|||||||
vec4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
vec4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
||||||
|
|
||||||
vec4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
vec4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 0
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 0
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 1
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 1
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 2
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 2
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 3
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 3
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 4
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 4
|
||||||
|
|
||||||
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||||
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||||
@ -354,11 +354,11 @@ getAdaptivePatchColor(ivec3 patchParam)
|
|||||||
if (edgeCount == 1) {
|
if (edgeCount == 1) {
|
||||||
patchType = 2; // BOUNDARY
|
patchType = 2; // BOUNDARY
|
||||||
}
|
}
|
||||||
if (edgeCount == 2) {
|
if (edgeCount > 1) {
|
||||||
patchType = 3; // CORNER
|
patchType = 3; // CORNER (not correct for patches that are not isolated)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
|
#if defined(OSD_PATCH_ENABLE_SINGLE_CREASE) && !defined(LOOP)
|
||||||
// check this after boundary/corner since single crease patch also has edgeCount.
|
// check this after boundary/corner since single crease patch also has edgeCount.
|
||||||
if (inpt.vSegments.y > 0) {
|
if (inpt.vSegments.y > 0) {
|
||||||
patchType = 1;
|
patchType = 1;
|
||||||
@ -369,6 +369,8 @@ getAdaptivePatchColor(ivec3 patchParam)
|
|||||||
patchType = 5;
|
patchType = 5;
|
||||||
#elif defined OSD_PATCH_GREGORY_BASIS
|
#elif defined OSD_PATCH_GREGORY_BASIS
|
||||||
patchType = 6;
|
patchType = 6;
|
||||||
|
#elif defined OSD_PATCH_GREGORY_TRIANGLE
|
||||||
|
patchType = 6;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pattern = bitCount(OsdGetPatchTransitionMask(patchParam));
|
int pattern = bitCount(OsdGetPatchTransitionMask(patchParam));
|
||||||
|
@ -207,6 +207,9 @@ createOsdMesh() {
|
|||||||
OpenSubdiv::Sdc::SchemeType sdctype = GetSdcType(*shape);
|
OpenSubdiv::Sdc::SchemeType sdctype = GetSdcType(*shape);
|
||||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||||
|
|
||||||
|
// Recall this application should not accept or include Bilinear shapes
|
||||||
|
assert(sdctype != OpenSubdiv::Sdc::SCHEME_BILINEAR);
|
||||||
|
|
||||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||||
@ -221,6 +224,7 @@ createOsdMesh() {
|
|||||||
bool doAdaptive = true;
|
bool doAdaptive = true;
|
||||||
OpenSubdiv::Osd::MeshBitset bits;
|
OpenSubdiv::Osd::MeshBitset bits;
|
||||||
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
|
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
|
||||||
|
bits.set(OpenSubdiv::Osd::MeshEndCapGregoryBasis, true);
|
||||||
|
|
||||||
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
|
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
|
||||||
OpenSubdiv::Far::StencilTable,
|
OpenSubdiv::Far::StencilTable,
|
||||||
@ -985,7 +989,7 @@ initHUD() {
|
|||||||
for (int i = 1; i < 11; ++i) {
|
for (int i = 1; i < 11; ++i) {
|
||||||
char level[16];
|
char level[16];
|
||||||
sprintf(level, "Lv. %d", i);
|
sprintf(level, "Lv. %d", i);
|
||||||
g_hud.AddRadioButton(3, level, i==2, 10, 170+i*20, callbackLevel, i, '0'+(i%10));
|
g_hud.AddRadioButton(3, level, i==g_level, 10, 170+i*20, callbackLevel, i, '0'+(i%10));
|
||||||
}
|
}
|
||||||
|
|
||||||
int pulldown_handle = g_hud.AddPullDown("Shape (N)", -300, 10, 300, callbackModel, 'n');
|
int pulldown_handle = g_hud.AddPullDown("Shape (N)", -300, 10, 300, callbackModel, 'n');
|
||||||
@ -1064,8 +1068,8 @@ idle() {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
||||||
printf("Error: %d\n", err);
|
printf("OpenSubdiv Error: %d\n", err);
|
||||||
printf("%s", message);
|
printf(" %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1079,23 +1083,39 @@ callbackErrorGLFW(int error, const char* description) {
|
|||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
|
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
std::string str;
|
Scheme defaultScheme = kCatmark;
|
||||||
|
std::vector<char const *> objfiles;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "-d"))
|
if (strstr(argv[i], ".obj")) {
|
||||||
|
objfiles.push_back(argv[i]);
|
||||||
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
g_level = atoi(argv[++i]);
|
g_level = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-f"))
|
} else if (!strcmp(argv[i], "-f")) {
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
else {
|
} else if (!strcmp(argv[i], "-catmark")) {
|
||||||
std::ifstream ifs(argv[1]);
|
defaultScheme = kCatmark;
|
||||||
if (ifs) {
|
} else if (!strcmp(argv[i], "-loop")) {
|
||||||
std::stringstream ss;
|
defaultScheme = kLoop;
|
||||||
ss << ifs.rdbuf();
|
} else if (!strcmp(argv[i], "-bilinear")) {
|
||||||
ifs.close();
|
printf("Warning: -bilinear ignored, Bilinear shapes not supported\n");
|
||||||
str = ss.str();
|
} else {
|
||||||
g_defaultShapes.push_back(ShapeDesc(argv[1], str.c_str(), kCatmark));
|
printf("Warning: unrecognized argument '%s' ignored\n", argv[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < (int)objfiles.size(); ++i) {
|
||||||
|
std::ifstream ifs(objfiles[i]);
|
||||||
|
if (ifs) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << ifs.rdbuf();
|
||||||
|
ifs.close();
|
||||||
|
std::string str = ss.str();
|
||||||
|
g_defaultShapes.push_back(ShapeDesc(objfiles[i], str.c_str(), defaultScheme));
|
||||||
|
} else {
|
||||||
|
printf("Warning: cannot open shape file '%s'\n", objfiles[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initShapes();
|
initShapes();
|
||||||
OpenSubdiv::Far::SetErrorCallback(callbackError);
|
OpenSubdiv::Far::SetErrorCallback(callbackError);
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ static std::vector<ShapeDesc> g_defaultShapes;
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void initShapes() {
|
static void initShapes() {
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -46,17 +47,12 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner4", catmark_cube_corner4, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner4", catmark_cube_corner4, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );
|
||||||
@ -76,5 +72,19 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
||||||
|
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
|
|
||||||
|
// REMEMBER: no Bilinear shapes here -- application requires a tessellation shader
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -180,7 +180,7 @@ int g_fullscreen = 0,
|
|||||||
g_wire = DISPLAY_SHADED,
|
g_wire = DISPLAY_SHADED,
|
||||||
g_drawNormals = 0,
|
g_drawNormals = 0,
|
||||||
g_mbutton[3] = {0, 0, 0},
|
g_mbutton[3] = {0, 0, 0},
|
||||||
g_level = 1,
|
g_level = 2,
|
||||||
g_tessLevel = 2,
|
g_tessLevel = 2,
|
||||||
g_kernel = kCPU,
|
g_kernel = kCPU,
|
||||||
g_scheme = 0,
|
g_scheme = 0,
|
||||||
@ -195,7 +195,7 @@ float g_moveScale = 0.0f,
|
|||||||
g_displacementScale = 1.0f,
|
g_displacementScale = 1.0f,
|
||||||
g_mipmapBias = 0.0;
|
g_mipmapBias = 0.0;
|
||||||
|
|
||||||
bool g_adaptive = false,
|
bool g_adaptive = true,
|
||||||
g_yup = false,
|
g_yup = false,
|
||||||
g_patchCull = true,
|
g_patchCull = true,
|
||||||
g_screenSpaceTess = true,
|
g_screenSpaceTess = true,
|
||||||
@ -441,6 +441,7 @@ createPTexGeo(PtexTexture * r) {
|
|||||||
Shape * shape = new Shape;
|
Shape * shape = new Shape;
|
||||||
|
|
||||||
shape->scheme = kCatmark;
|
shape->scheme = kCatmark;
|
||||||
|
assert(r->meshType() == Ptex::mt_quad);
|
||||||
|
|
||||||
shape->verts.resize(nvp);
|
shape->verts.resize(nvp);
|
||||||
for (int i=0; i<nvp; ++i) {
|
for (int i=0; i<nvp; ++i) {
|
||||||
@ -699,7 +700,6 @@ public:
|
|||||||
if (effectDesc.effect.ibl)
|
if (effectDesc.effect.ibl)
|
||||||
ss << "#define USE_IBL\n";
|
ss << "#define USE_IBL\n";
|
||||||
|
|
||||||
|
|
||||||
// need for patch color-coding : we need these defines in the fragment shader
|
// need for patch color-coding : we need these defines in the fragment shader
|
||||||
if (type == Far::PatchDescriptor::GREGORY) {
|
if (type == Far::PatchDescriptor::GREGORY) {
|
||||||
ss << "#define OSD_PATCH_GREGORY\n";
|
ss << "#define OSD_PATCH_GREGORY\n";
|
||||||
@ -707,6 +707,15 @@ public:
|
|||||||
ss << "#define OSD_PATCH_GREGORY_BOUNDARY\n";
|
ss << "#define OSD_PATCH_GREGORY_BOUNDARY\n";
|
||||||
} else if (type == Far::PatchDescriptor::GREGORY_BASIS) {
|
} else if (type == Far::PatchDescriptor::GREGORY_BASIS) {
|
||||||
ss << "#define OSD_PATCH_GREGORY_BASIS\n";
|
ss << "#define OSD_PATCH_GREGORY_BASIS\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::LOOP) {
|
||||||
|
ss << "#define OSD_PATCH_LOOP\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
|
||||||
|
ss << "#define OSD_PATCH_GREGORY_TRIANGLE\n";
|
||||||
|
}
|
||||||
|
if (type == Far::PatchDescriptor::TRIANGLES ||
|
||||||
|
type == Far::PatchDescriptor::LOOP ||
|
||||||
|
type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
|
||||||
|
ss << "#define LOOP\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// include osd PatchCommon
|
// include osd PatchCommon
|
||||||
@ -835,6 +844,10 @@ createPtex(const char *filename, int memLimit) {
|
|||||||
printf("Error in reading %s\n", filename);
|
printf("Error in reading %s\n", filename);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (ptex->meshType() == Ptex::mt_triangle) {
|
||||||
|
printf("Error in %s: triangular Ptex not yet supported\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
size_t targetMemory = memLimit * 1024 * 1024; // MB
|
size_t targetMemory = memLimit * 1024 * 1024; // MB
|
||||||
|
|
||||||
@ -872,6 +885,10 @@ createOsdMesh(int level, int kernel) {
|
|||||||
printf("Error in reading %s\n", g_ptexColorFilename);
|
printf("Error in reading %s\n", g_ptexColorFilename);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (ptexColor->meshType() == Ptex::mt_triangle) {
|
||||||
|
printf("Error in %s: triangular Ptex not yet supported\n", g_ptexColorFilename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// generate Shape representation from ptex
|
// generate Shape representation from ptex
|
||||||
Shape * shape = createPTexGeo(ptexColor);
|
Shape * shape = createPTexGeo(ptexColor);
|
||||||
@ -900,11 +917,8 @@ createOsdMesh(int level, int kernel) {
|
|||||||
delete g_mesh;
|
delete g_mesh;
|
||||||
g_mesh = NULL;
|
g_mesh = NULL;
|
||||||
|
|
||||||
// Adaptive refinement currently supported only for catmull-clark scheme
|
|
||||||
bool doAdaptive = (g_adaptive != 0 && g_scheme == 0);
|
|
||||||
|
|
||||||
OpenSubdiv::Osd::MeshBitset bits;
|
OpenSubdiv::Osd::MeshBitset bits;
|
||||||
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
|
bits.set(OpenSubdiv::Osd::MeshAdaptive, g_adaptive);
|
||||||
bits.set(OpenSubdiv::Osd::MeshEndCapGregoryBasis, true);
|
bits.set(OpenSubdiv::Osd::MeshEndCapGregoryBasis, true);
|
||||||
|
|
||||||
int numVertexElements = g_adaptive ? 3 : 6;
|
int numVertexElements = g_adaptive ? 3 : 6;
|
||||||
@ -1423,7 +1437,7 @@ display() {
|
|||||||
g_hud.DrawString(10, -160, "Primitives : %d", numPrimsGenerated);
|
g_hud.DrawString(10, -160, "Primitives : %d", numPrimsGenerated);
|
||||||
}
|
}
|
||||||
g_hud.DrawString(10, -140, "Vertices : %d", g_mesh->GetNumVertices());
|
g_hud.DrawString(10, -140, "Vertices : %d", g_mesh->GetNumVertices());
|
||||||
g_hud.DrawString(10, -120, "Scheme : %s", g_scheme == 0 ? "CATMARK" : "LOOP");
|
g_hud.DrawString(10, -120, "Scheme : %s", g_scheme == 0 ? "CATMARK" : "BILINEAR");
|
||||||
g_hud.DrawString(10, -100, "GPU Kernel : %.3f ms", g_gpuTime);
|
g_hud.DrawString(10, -100, "GPU Kernel : %.3f ms", g_gpuTime);
|
||||||
g_hud.DrawString(10, -80, "CPU Kernel : %.3f ms", g_cpuTime);
|
g_hud.DrawString(10, -80, "CPU Kernel : %.3f ms", g_cpuTime);
|
||||||
g_hud.DrawString(10, -60, "GPU Draw : %.3f ms", drawGpuTime);
|
g_hud.DrawString(10, -60, "GPU Draw : %.3f ms", drawGpuTime);
|
||||||
@ -1703,8 +1717,8 @@ void usage(const char *program) {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
callbackError(OpenSubdiv::Far::ErrorType err, const char *message) {
|
||||||
printf("Error: %d\n", err);
|
printf("OpenSubdiv Error: %d\n", err);
|
||||||
printf("%s", message);
|
printf(" %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1727,6 +1741,10 @@ int main(int argc, char ** argv) {
|
|||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (strstr(argv[i], ".obj"))
|
if (strstr(argv[i], ".obj"))
|
||||||
animobjs.push_back(argv[i]);
|
animobjs.push_back(argv[i]);
|
||||||
|
else if (!strcmp(argv[i], "-a"))
|
||||||
|
g_adaptive = true;
|
||||||
|
else if (!strcmp(argv[i], "-u"))
|
||||||
|
g_adaptive = false;
|
||||||
else if (!strcmp(argv[i], "-l"))
|
else if (!strcmp(argv[i], "-l"))
|
||||||
g_level = atoi(argv[++i]);
|
g_level = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-c"))
|
else if (!strcmp(argv[i], "-c"))
|
||||||
@ -1847,7 +1865,7 @@ int main(int argc, char ** argv) {
|
|||||||
reshape();
|
reshape();
|
||||||
|
|
||||||
// activate feature adaptive tessellation if OSD supports it
|
// activate feature adaptive tessellation if OSD supports it
|
||||||
g_adaptive = GLUtils::SupportsAdaptiveTessellation();
|
g_adaptive = g_adaptive && GLUtils::SupportsAdaptiveTessellation();
|
||||||
|
|
||||||
int windowWidth = g_width, windowHeight = g_height;
|
int windowWidth = g_width, windowHeight = g_height;
|
||||||
|
|
||||||
|
@ -437,11 +437,11 @@ GetOverrideColor(ivec3 patchParam)
|
|||||||
vec4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
vec4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
||||||
|
|
||||||
vec4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
vec4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 0
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 0
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 1
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 1
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 2
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 2
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 3
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 3
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 4
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 4
|
||||||
|
|
||||||
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||||
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||||
@ -466,8 +466,18 @@ GetOverrideColor(ivec3 patchParam)
|
|||||||
);
|
);
|
||||||
|
|
||||||
int patchType = 0;
|
int patchType = 0;
|
||||||
#if defined OSD_PATCH_SINGLE_CREASE
|
|
||||||
if (inpt.sharpness > 0) {
|
int edgeCount = bitCount(OsdGetPatchBoundaryMask(patchParam));
|
||||||
|
if (edgeCount == 1) {
|
||||||
|
patchType = 2; // BOUNDARY
|
||||||
|
}
|
||||||
|
if (edgeCount > 1) {
|
||||||
|
patchType = 3; // CORNER (not correct for patches that are not isolated)
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(OSD_PATCH_ENABLE_SINGLE_CREASE) && !defined(LOOP)
|
||||||
|
// check this after boundary/corner since single crease patch also has edgeCount.
|
||||||
|
if (inpt.vSegments.y > 0) {
|
||||||
patchType = 1;
|
patchType = 1;
|
||||||
}
|
}
|
||||||
#elif defined OSD_PATCH_GREGORY
|
#elif defined OSD_PATCH_GREGORY
|
||||||
@ -476,16 +486,10 @@ GetOverrideColor(ivec3 patchParam)
|
|||||||
patchType = 5;
|
patchType = 5;
|
||||||
#elif defined OSD_PATCH_GREGORY_BASIS
|
#elif defined OSD_PATCH_GREGORY_BASIS
|
||||||
patchType = 6;
|
patchType = 6;
|
||||||
|
#elif defined OSD_PATCH_GREGORY_TRIANGLE
|
||||||
|
patchType = 6;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int edgeCount = bitCount(OsdGetPatchBoundaryMask(patchParam));
|
|
||||||
if (edgeCount == 1) {
|
|
||||||
patchType = 2; // BOUNDARY
|
|
||||||
}
|
|
||||||
if (edgeCount == 2) {
|
|
||||||
patchType = 3; // CORNER
|
|
||||||
}
|
|
||||||
|
|
||||||
int pattern = bitCount(OsdGetPatchTransitionMask(patchParam));
|
int pattern = bitCount(OsdGetPatchTransitionMask(patchParam));
|
||||||
|
|
||||||
return patchColors[6*patchType + pattern];
|
return patchColors[6*patchType + pattern];
|
||||||
|
@ -146,7 +146,7 @@ float g_cpuTime = 0;
|
|||||||
float g_gpuTime = 0;
|
float g_gpuTime = 0;
|
||||||
Stopwatch g_fpsTimer;
|
Stopwatch g_fpsTimer;
|
||||||
|
|
||||||
int g_level = 1;
|
int g_level = 2;
|
||||||
int g_tessLevel = 1;
|
int g_tessLevel = 1;
|
||||||
int g_tessLevelMin = 1;
|
int g_tessLevelMin = 1;
|
||||||
int g_frame = 0;
|
int g_frame = 0;
|
||||||
@ -372,6 +372,15 @@ public:
|
|||||||
ss << "#define OSD_PATCH_GREGORY_BOUNDARY\n";
|
ss << "#define OSD_PATCH_GREGORY_BOUNDARY\n";
|
||||||
} else if (type == Far::PatchDescriptor::GREGORY_BASIS) {
|
} else if (type == Far::PatchDescriptor::GREGORY_BASIS) {
|
||||||
ss << "#define OSD_PATCH_GREGORY_BASIS\n";
|
ss << "#define OSD_PATCH_GREGORY_BASIS\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::LOOP) {
|
||||||
|
ss << "#define OSD_PATCH_LOOP\n";
|
||||||
|
} else if (type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
|
||||||
|
ss << "#define OSD_PATCH_GREGORY_TRIANGLE\n";
|
||||||
|
}
|
||||||
|
if (type == Far::PatchDescriptor::TRIANGLES ||
|
||||||
|
type == Far::PatchDescriptor::LOOP ||
|
||||||
|
type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
|
||||||
|
ss << "#define LOOP\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// for legacy gregory
|
// for legacy gregory
|
||||||
@ -1107,10 +1116,10 @@ initHUD() {
|
|||||||
|
|
||||||
int endcap_pulldown = g_hud.AddPullDown(
|
int endcap_pulldown = g_hud.AddPullDown(
|
||||||
"End cap (E)", 10, 210, 200, callbackEndCap, 'e');
|
"End cap (E)", 10, 210, 200, callbackEndCap, 'e');
|
||||||
g_hud.AddPullDownButton(endcap_pulldown, "BSpline",
|
g_hud.AddPullDownButton(endcap_pulldown, "Regular",
|
||||||
SceneBase::kEndCapBSplineBasis,
|
SceneBase::kEndCapBSplineBasis,
|
||||||
g_options.endCap == SceneBase::kEndCapBSplineBasis);
|
g_options.endCap == SceneBase::kEndCapBSplineBasis);
|
||||||
g_hud.AddPullDownButton(endcap_pulldown, "GregoryBasis",
|
g_hud.AddPullDownButton(endcap_pulldown, "Gregory",
|
||||||
SceneBase::kEndCapGregoryBasis,
|
SceneBase::kEndCapGregoryBasis,
|
||||||
g_options.endCap == SceneBase::kEndCapGregoryBasis);
|
g_options.endCap == SceneBase::kEndCapGregoryBasis);
|
||||||
}
|
}
|
||||||
@ -1119,7 +1128,7 @@ initHUD() {
|
|||||||
for (int i = 1; i < 11; ++i) {
|
for (int i = 1; i < 11; ++i) {
|
||||||
char level[16];
|
char level[16];
|
||||||
sprintf(level, "Lv. %d", i);
|
sprintf(level, "Lv. %d", i);
|
||||||
g_hud.AddRadioButton(3, level, i==2, 10, 210+i*20, callbackLevel, i, '0'+(i%10));
|
g_hud.AddRadioButton(3, level, i==g_level, 10, 210+i*20, callbackLevel, i, '0'+(i%10));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hud.Rebuild(windowWidth, windowHeight, frameBufferWidth, frameBufferHeight);
|
g_hud.Rebuild(windowWidth, windowHeight, frameBufferWidth, frameBufferHeight);
|
||||||
@ -1153,8 +1162,8 @@ idle() {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
callbackError(Far::ErrorType err, const char *message) {
|
callbackError(Far::ErrorType err, const char *message) {
|
||||||
printf("Error: %d\n", err);
|
printf("OpenSubdiv Error: %d\n", err);
|
||||||
printf("%s", message);
|
printf(" %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1168,8 +1177,12 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
std::string str;
|
std::string str;
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "-d")) {
|
if (!strcmp(argv[i], "-l")) {
|
||||||
g_level = atoi(argv[++i]);
|
g_level = atoi(argv[++i]);
|
||||||
|
} else if (!strcmp(argv[i], "-a")) {
|
||||||
|
g_options.adaptive = true;
|
||||||
|
} else if (!strcmp(argv[i], "-u")) {
|
||||||
|
g_options.adaptive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Far::SetErrorCallback(callbackError);
|
Far::SetErrorCallback(callbackError);
|
||||||
@ -1217,9 +1230,6 @@ int main(int argc, char ** argv) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// activate feature adaptive tessellation if OSD supports it
|
|
||||||
g_options.adaptive = true;
|
|
||||||
|
|
||||||
initShapes();
|
initShapes();
|
||||||
initGL();
|
initGL();
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ static std::vector<ShapeDesc> g_defaultShapes;
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void initShapes() {
|
static void initShapes() {
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -49,17 +50,15 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
||||||
@ -87,30 +86,31 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris0", catmark_smoothtris0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris0", catmark_smoothtris0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris1", catmark_smoothtris1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris1", catmark_smoothtris1, kCatmark ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit0", catmark_square_hedit0, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit1", catmark_square_hedit1, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit2", catmark_square_hedit2, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit3", catmark_square_hedit3, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
||||||
|
|
||||||
#if 0
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
|
||||||
|
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgecorner", loop_saddle_edgecorner, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgeonly", loop_saddle_edgeonly, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
||||||
#endif
|
g_defaultShapes.push_back( ShapeDesc("loop_pole8", loop_pole8, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_pole64", loop_pole64, kLoop ) );
|
||||||
|
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear ) );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
kEndCapGregoryBasis };
|
kEndCapGregoryBasis };
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
Options() : adaptive(true), endCap(kEndCapBSplineBasis) { }
|
Options() : adaptive(true), endCap(kEndCapGregoryBasis) { }
|
||||||
|
|
||||||
bool adaptive;
|
bool adaptive;
|
||||||
int endCap;
|
int endCap;
|
||||||
|
@ -386,11 +386,11 @@ getAdaptivePatchColor(ivec3 patchParam)
|
|||||||
vec4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
vec4(0.0f, 0.8f, 0.75f, 1.0f), // boundary pattern 4
|
||||||
|
|
||||||
vec4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
vec4(0.0f, 1.0f, 0.0f, 1.0f), // corner
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 0
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 0
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 1
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 1
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 2
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 2
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 3
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 3
|
||||||
vec4(0.25f, 0.25f, 0.25f, 1.0f), // corner pattern 4
|
vec4(0.5f, 1.0f, 0.5f, 1.0f), // corner pattern 4
|
||||||
|
|
||||||
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||||
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
vec4(1.0f, 1.0f, 0.0f, 1.0f), // gregory
|
||||||
@ -415,27 +415,32 @@ getAdaptivePatchColor(ivec3 patchParam)
|
|||||||
);
|
);
|
||||||
|
|
||||||
int patchType = 0;
|
int patchType = 0;
|
||||||
#if defined OSD_PATCH_GREGORY
|
|
||||||
patchType = 4;
|
|
||||||
#elif defined OSD_PATCH_GREGORY_BOUNDARY
|
|
||||||
patchType = 5;
|
|
||||||
#elif defined OSD_PATCH_GREGORY_BASIS
|
|
||||||
patchType = 6;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int edgeCount = bitCount(OsdGetPatchBoundaryMask(patchParam));
|
int edgeCount = bitCount(OsdGetPatchBoundaryMask(patchParam));
|
||||||
if (edgeCount == 1) {
|
if (edgeCount == 1) {
|
||||||
patchType = 2; // BOUNDARY
|
patchType = 2; // BOUNDARY
|
||||||
}
|
}
|
||||||
if (edgeCount == 2) {
|
if (edgeCount > 1) {
|
||||||
patchType = 3; // CORNER
|
patchType = 3; // CORNER (not correct for patches that are not isolated)
|
||||||
}
|
}
|
||||||
|
|
||||||
int pattern = bitCount(OsdGetPatchTransitionMask(patchParam));
|
#if defined(OSD_PATCH_ENABLE_SINGLE_CREASE) && !defined(LOOP)
|
||||||
#ifdef OSD_PATCH_ENABLE_SINGLE_CREASE
|
// check this after boundary/corner since single crease patch also has edgeCount.
|
||||||
if (inpt.sharpness > 0) pattern += 6;
|
if (inpt.vSegments.y > 0) {
|
||||||
|
patchType = 1;
|
||||||
|
}
|
||||||
|
#elif defined OSD_PATCH_GREGORY
|
||||||
|
patchType = 4;
|
||||||
|
#elif defined OSD_PATCH_GREGORY_BOUNDARY
|
||||||
|
patchType = 5;
|
||||||
|
#elif defined OSD_PATCH_GREGORY_BASIS
|
||||||
|
patchType = 6;
|
||||||
|
#elif defined OSD_PATCH_GREGORY_TRIANGLE
|
||||||
|
patchType = 6;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int pattern = bitCount(OsdGetPatchTransitionMask(patchParam));
|
||||||
|
|
||||||
return patchColors[6*patchType + pattern];
|
return patchColors[6*patchType + pattern];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ enum HudCheckBox { kHUD_CB_DISPLAY_CONTROL_MESH_EDGES,
|
|||||||
kHUD_CB_INF_SHARP_PATCH };
|
kHUD_CB_INF_SHARP_PATCH };
|
||||||
|
|
||||||
int g_kernel = kCPU,
|
int g_kernel = kCPU,
|
||||||
g_isolationLevel = 5; // max level of extraordinary feature isolation
|
g_isolationLevel = 2; // max level of extraordinary feature isolation
|
||||||
|
|
||||||
int g_running = 1,
|
int g_running = 1,
|
||||||
g_width = 1024,
|
g_width = 1024,
|
||||||
@ -1061,36 +1061,39 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
Scheme defaultScheme = kCatmark;
|
Scheme defaultScheme = kCatmark;
|
||||||
std::string str;
|
std::vector<char const *> objfiles;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "-u")) {
|
if (strstr(argv[i], ".obj")) {
|
||||||
|
objfiles.push_back(argv[i]);
|
||||||
|
} else if (!strcmp(argv[i], "-a")) {
|
||||||
|
g_adaptive = true;
|
||||||
|
} else if (!strcmp(argv[i], "-u")) {
|
||||||
g_adaptive = false;
|
g_adaptive = false;
|
||||||
}
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
if (!strcmp(argv[i], "-d")) {
|
|
||||||
g_isolationLevel = atoi(argv[++i]);
|
g_isolationLevel = atoi(argv[++i]);
|
||||||
}
|
} else if (!strcmp(argv[i], "-f")) {
|
||||||
else if (!strcmp(argv[i], "-f")) {
|
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
}
|
} else if (!strcmp(argv[i], "-bilinear")) {
|
||||||
else if (!strcmp(argv[i], "-bilinear")) {
|
|
||||||
defaultScheme = kBilinear;
|
defaultScheme = kBilinear;
|
||||||
}
|
} else if (!strcmp(argv[i], "-catmark")) {
|
||||||
else if (!strcmp(argv[i], "-catmark")) {
|
|
||||||
defaultScheme = kCatmark;
|
defaultScheme = kCatmark;
|
||||||
}
|
} else if (!strcmp(argv[i], "-loop")) {
|
||||||
else if (!strcmp(argv[i], "-loop")) {
|
|
||||||
defaultScheme = kLoop;
|
defaultScheme = kLoop;
|
||||||
|
} else {
|
||||||
|
printf("Warning: unrecognized argument '%s' ignored\n", argv[i]);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
std::ifstream ifs(argv[i]);
|
for (int i = 0; i < (int)objfiles.size(); ++i) {
|
||||||
if (ifs) {
|
std::ifstream ifs(objfiles[i]);
|
||||||
std::stringstream ss;
|
if (ifs) {
|
||||||
ss << ifs.rdbuf();
|
std::stringstream ss;
|
||||||
ifs.close();
|
ss << ifs.rdbuf();
|
||||||
str = ss.str();
|
ifs.close();
|
||||||
g_defaultShapes.push_back(ShapeDesc(argv[i], str.c_str(), defaultScheme));
|
std::string str = ss.str();
|
||||||
}
|
g_defaultShapes.push_back(ShapeDesc(objfiles[i], str.c_str(), defaultScheme));
|
||||||
|
} else {
|
||||||
|
printf("Warning: cannot open shape file '%s'\n", objfiles[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,7 @@ static std::vector<ShapeDesc> g_defaultShapes;
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void initShapes() {
|
static void initShapes() {
|
||||||
// g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -48,17 +47,12 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner4", catmark_cube_corner4, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner4", catmark_cube_corner4, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );
|
||||||
@ -76,27 +70,29 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit0", catmark_square_hedit0, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit1", catmark_square_hedit1, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit2", catmark_square_hedit2, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit3", catmark_square_hedit3, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
||||||
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_pole8", loop_pole8, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_pole64", loop_pole64, kLoop ) );
|
||||||
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgecorner", loop_saddle_edgecorner, kLoop ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgeonly", loop_saddle_edgeonly, kLoop ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -71,6 +71,7 @@ GLFWmonitor* g_primary=0;
|
|||||||
#include <opensubdiv/osd/glLegacyGregoryPatchTable.h>
|
#include <opensubdiv/osd/glLegacyGregoryPatchTable.h>
|
||||||
OpenSubdiv::Osd::GLMeshInterface *g_mesh = NULL;
|
OpenSubdiv::Osd::GLMeshInterface *g_mesh = NULL;
|
||||||
OpenSubdiv::Osd::GLLegacyGregoryPatchTable *g_legacyGregoryPatchTable = NULL;
|
OpenSubdiv::Osd::GLLegacyGregoryPatchTable *g_legacyGregoryPatchTable = NULL;
|
||||||
|
bool g_legacyGregoryEnabled = false;
|
||||||
|
|
||||||
#include "../../regression/common/far_utils.h"
|
#include "../../regression/common/far_utils.h"
|
||||||
#include "../common/glHud.h"
|
#include "../common/glHud.h"
|
||||||
@ -183,7 +184,7 @@ int g_fullscreen = 0,
|
|||||||
g_shadingMode = kShadingPatchType,
|
g_shadingMode = kShadingPatchType,
|
||||||
g_displayStyle = kDisplayStyleWireOnShaded,
|
g_displayStyle = kDisplayStyleWireOnShaded,
|
||||||
g_adaptive = 1,
|
g_adaptive = 1,
|
||||||
g_endCap = kEndCapBSplineBasis,
|
g_endCap = kEndCapGregoryBasis,
|
||||||
g_smoothCornerPatch = 0,
|
g_smoothCornerPatch = 0,
|
||||||
g_singleCreasePatch = 1,
|
g_singleCreasePatch = 1,
|
||||||
g_infSharpPatch = 0,
|
g_infSharpPatch = 0,
|
||||||
@ -1199,7 +1200,7 @@ display() {
|
|||||||
|
|
||||||
if (g_displayPatchCounts) {
|
if (g_displayPatchCounts) {
|
||||||
int x = -420;
|
int x = -420;
|
||||||
int y = -180;
|
int y = g_legacyGregoryEnabled ? -180 : -140;
|
||||||
g_hud.DrawString(x, y, "Quads : %d",
|
g_hud.DrawString(x, y, "Quads : %d",
|
||||||
patchCount[Descriptor::QUADS]); y += 20;
|
patchCount[Descriptor::QUADS]); y += 20;
|
||||||
g_hud.DrawString(x, y, "Triangles : %d",
|
g_hud.DrawString(x, y, "Triangles : %d",
|
||||||
@ -1208,10 +1209,12 @@ display() {
|
|||||||
patchCount[Descriptor::REGULAR]); y+= 20;
|
patchCount[Descriptor::REGULAR]); y+= 20;
|
||||||
g_hud.DrawString(x, y, "Loop : %d",
|
g_hud.DrawString(x, y, "Loop : %d",
|
||||||
patchCount[Descriptor::LOOP]); y+= 20;
|
patchCount[Descriptor::LOOP]); y+= 20;
|
||||||
g_hud.DrawString(x, y, "Gregory : %d",
|
if (g_legacyGregoryEnabled) {
|
||||||
patchCount[Descriptor::GREGORY]); y+= 20;
|
g_hud.DrawString(x, y, "Gregory : %d",
|
||||||
g_hud.DrawString(x, y, "Gregory Boundary : %d",
|
patchCount[Descriptor::GREGORY]); y+= 20;
|
||||||
patchCount[Descriptor::GREGORY_BOUNDARY]); y+= 20;
|
g_hud.DrawString(x, y, "Gregory Boundary : %d",
|
||||||
|
patchCount[Descriptor::GREGORY_BOUNDARY]); y+= 20;
|
||||||
|
}
|
||||||
g_hud.DrawString(x, y, "Gregory Basis : %d",
|
g_hud.DrawString(x, y, "Gregory Basis : %d",
|
||||||
patchCount[Descriptor::GREGORY_BASIS]); y+= 20;
|
patchCount[Descriptor::GREGORY_BASIS]); y+= 20;
|
||||||
g_hud.DrawString(x, y, "Gregory Triangle : %d",
|
g_hud.DrawString(x, y, "Gregory Triangle : %d",
|
||||||
@ -1581,9 +1584,11 @@ initHUD() {
|
|||||||
g_hud.AddPullDownButton(endcap_pulldown, "Gregory",
|
g_hud.AddPullDownButton(endcap_pulldown, "Gregory",
|
||||||
kEndCapGregoryBasis,
|
kEndCapGregoryBasis,
|
||||||
g_endCap == kEndCapGregoryBasis);
|
g_endCap == kEndCapGregoryBasis);
|
||||||
g_hud.AddPullDownButton(endcap_pulldown, "LegacyGregory",
|
if (g_legacyGregoryEnabled) {
|
||||||
kEndCapLegacyGregory,
|
g_hud.AddPullDownButton(endcap_pulldown, "LegacyGregory",
|
||||||
g_endCap == kEndCapLegacyGregory);
|
kEndCapLegacyGregory,
|
||||||
|
g_endCap == kEndCapLegacyGregory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < 11; ++i) {
|
for (int i = 1; i < 11; ++i) {
|
||||||
@ -1632,8 +1637,8 @@ idle() {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void
|
static void
|
||||||
callbackErrorOsd(OpenSubdiv::Far::ErrorType err, const char *message) {
|
callbackErrorOsd(OpenSubdiv::Far::ErrorType err, const char *message) {
|
||||||
printf("Error: %d\n", err);
|
printf("OpenSubdiv Error: %d\n", err);
|
||||||
printf("%s", message);
|
printf(" %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1648,54 +1653,59 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
Scheme defaultScheme = kCatmark;
|
Scheme defaultScheme = kCatmark;
|
||||||
std::string str;
|
std::vector<char const *> objfiles;
|
||||||
std::vector<char const *> animobjs;
|
bool objAnimFlag = false;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (strstr(argv[i], ".obj")) {
|
if (strstr(argv[i], ".obj")) {
|
||||||
animobjs.push_back(argv[i]);
|
objfiles.push_back(argv[i]);
|
||||||
}
|
} else if (!strcmp(argv[i], "-a")) {
|
||||||
else if (!strcmp(argv[i], "-axis")) {
|
g_adaptive = true;
|
||||||
g_axis = false;
|
} else if (!strcmp(argv[i], "-u")) {
|
||||||
}
|
|
||||||
else if (!strcmp(argv[i], "-u")) {
|
|
||||||
g_adaptive = false;
|
g_adaptive = false;
|
||||||
}
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
else if (!strcmp(argv[i], "-d")) {
|
|
||||||
if (++i < argc) g_level = atoi(argv[i]);
|
if (++i < argc) g_level = atoi(argv[i]);
|
||||||
}
|
} else if (!strcmp(argv[i], "-axis")) {
|
||||||
else if (!strcmp(argv[i], "-c")) {
|
g_axis = false;
|
||||||
|
} else if (!strcmp(argv[i], "-c")) {
|
||||||
if (++i < argc) g_repeatCount = atoi(argv[i]);
|
if (++i < argc) g_repeatCount = atoi(argv[i]);
|
||||||
}
|
} else if (!strcmp(argv[i], "-f")) {
|
||||||
else if (!strcmp(argv[i], "-f")) {
|
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
}
|
} else if (!strcmp(argv[i], "-anim")) {
|
||||||
else if (!strcmp(argv[i], "-bilinear")) {
|
objAnimFlag = true;
|
||||||
|
} else if (!strcmp(argv[i], "-bilinear")) {
|
||||||
defaultScheme = kBilinear;
|
defaultScheme = kBilinear;
|
||||||
}
|
} else if (!strcmp(argv[i], "-catmark")) {
|
||||||
else if (!strcmp(argv[i], "-catmark")) {
|
|
||||||
defaultScheme = kCatmark;
|
defaultScheme = kCatmark;
|
||||||
}
|
} else if (!strcmp(argv[i], "-loop")) {
|
||||||
else if (!strcmp(argv[i], "-loop")) {
|
|
||||||
defaultScheme = kLoop;
|
defaultScheme = kLoop;
|
||||||
}
|
} else if (!strcmp(argv[i], "-lg")) {
|
||||||
else {
|
g_legacyGregoryEnabled = true;
|
||||||
std::ifstream ifs(argv[i]);
|
} else {
|
||||||
if (ifs) {
|
printf("Warning: unrecognized argument '%s' ignored\n", argv[i]);
|
||||||
std::stringstream ss;
|
|
||||||
ss << ifs.rdbuf();
|
|
||||||
ifs.close();
|
|
||||||
str = ss.str();
|
|
||||||
g_defaultShapes.push_back(ShapeDesc(argv[i], str.c_str(), defaultScheme));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! animobjs.empty()) {
|
if (! objfiles.empty()) {
|
||||||
|
if (objAnimFlag) {
|
||||||
g_defaultShapes.push_back(ShapeDesc(animobjs[0], "", defaultScheme));
|
g_objAnim = ObjAnim::Create(objfiles, g_axis, defaultScheme);
|
||||||
|
if (g_objAnim) {
|
||||||
g_objAnim = ObjAnim::Create(animobjs, g_axis, defaultScheme);
|
g_defaultShapes.push_back(ShapeDesc(objfiles[0], "", defaultScheme));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < (int)objfiles.size(); ++i) {
|
||||||
|
std::ifstream ifs(objfiles[i]);
|
||||||
|
if (ifs) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << ifs.rdbuf();
|
||||||
|
ifs.close();
|
||||||
|
std::string str = ss.str();
|
||||||
|
g_defaultShapes.push_back(ShapeDesc(objfiles[i], str.c_str(), defaultScheme));
|
||||||
|
} else {
|
||||||
|
printf("Warning: cannot open shape file '%s'\n", objfiles[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initShapes();
|
initShapes();
|
||||||
|
@ -41,6 +41,7 @@ static std::vector<ShapeDesc> g_defaultShapes;
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void initShapes() {
|
static void initShapes() {
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner0", catmark_cube_corner0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner1", catmark_cube_corner1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_corner2", catmark_cube_corner2, kCatmark ) );
|
||||||
@ -49,11 +50,11 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases0", catmark_cube_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases1", catmark_cube_creases1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_cube_creases2", catmark_cube_creases2, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_cube", catmark_cube, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgecorner", catmark_dart_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_dart_edgeonly", catmark_dart_edgeonly, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgecorner", catmark_edgecorner, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_edgeonly", catmark_edgeonly, kCatmark ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("catmark_quadstrips", catmark_quadstrips, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
|
||||||
@ -61,11 +62,6 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease0", catmark_inf_crease0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease0", catmark_inf_crease0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease1", catmark_inf_crease1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease1", catmark_inf_crease1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test0", catmark_gregory_test0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test0", catmark_gregory_test0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
|
||||||
@ -96,30 +92,31 @@ static void initShapes() {
|
|||||||
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris0", catmark_smoothtris0, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris0", catmark_smoothtris0, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris1", catmark_smoothtris1, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris1", catmark_smoothtris1, kCatmark ) );
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit0", catmark_square_hedit0, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit1", catmark_square_hedit1, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit2", catmark_square_hedit2, kCatmark ) );
|
|
||||||
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit3", catmark_square_hedit3, kCatmark ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_bishop", catmark_bishop, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_car", catmark_car, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_pawn", catmark_pawn, kCatmark ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
g_defaultShapes.push_back( ShapeDesc("catmark_rook", catmark_rook, kCatmark ) );
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
|
||||||
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) );
|
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube", loop_cube, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_semisharp", loop_cubes_semisharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgecorner", loop_saddle_edgecorner, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cubes_infsharp", loop_cubes_infsharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_saddle_edgeonly", loop_saddle_edgeonly, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_cube_asymmetric", loop_cube_asymmetric, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgecorner", loop_triangle_edgecorner, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_triangle_edgeonly", loop_triangle_edgeonly, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_interior", loop_xord_interior, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_xord_boundary", loop_xord_boundary, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icosahedron", loop_icosahedron, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_semisharp", loop_icos_semisharp, kLoop ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("loop_icos_infsharp", loop_icos_infsharp, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_chaikin0", loop_chaikin0, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_chaikin1", loop_chaikin1, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_pole8", loop_pole8, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_pole8", loop_pole8, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_pole64", loop_pole64, kLoop ) );
|
g_defaultShapes.push_back( ShapeDesc("loop_pole64", loop_pole64, kLoop ) );
|
||||||
g_defaultShapes.push_back( ShapeDesc("loop_pole360", loop_pole360, kLoop ) );
|
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_cube", bilinear_cube, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonplanar", bilinear_nonplanar, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads0", bilinear_nonquads0, kBilinear ) );
|
||||||
|
g_defaultShapes.push_back( ShapeDesc("bilinear_nonquads1", bilinear_nonquads1, kBilinear ) );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user