Yes, OBJToolkit does support materials with textures.
But don't forget that materials definitions aren't a part of .obj file and stored in .mtl file. Obj file has references to those .mtl file(s) (lines with mtllib token, as mtllib filename.mtl) to take materials definitions from. Materials definitions in .mtl files refer jpg/bmp/... files, so if you have images of .obj file but there isn't any corresponding .mtl file, materials (and textures) won't be imported.
How to turn off the default light in the environment? Which function do I need to call to implement it? Can you tell me how can I turn off the default light?
There is no any lighting in 2dWireframe, 3dWireframe and HiddenLine rendering modes. Lighting exists only in Shaded rendering modes.
Following Database Variables can be used to control behavior of lights inside drawing viewports:
You must take into account that if you will disable Default Lighting, you must provide your own light sources into Database, elsewhere default lights will be enabled even if you disabled them. This behavior is logically correct, because if your graphics scene haven't at least one light source - your Shaded geometry will not be highlighted, so all graphics inside scene will be black and I don't think that anybody expects such result (very similar result will be shown in case if you switch onto HiddenLine rendering mode).
You can add distant light into your drawing, after that you can disable default lighting since your graphics scene will contain non-default light.
OdDbLightPtr pLight = OdDbLight::createObject(); pLight->setDatabaseDefaults(pDb); pLight->setLightType(OdGiDrawable::kDistantLight); pLight->setLightDirection(OdGeVector3d::kZAxis); OdDbBlockTableRecord::cast(pDb->getActiveLayoutBTRId().openObject(OdDb::kForWrite))->appendOdDbEntity(pLight);
In our application we want to have two or more model viewports on separate windows. How to implement this?
To draw in set of windows you need create separate OdGsDevice for each window. You can use same OdGiContextForDbDatabase for each device. OdEdBaseIO and OdExEditorObject is realated for editing capabilities and doesn't related to device. Trackers attached onto OdGsView, so there is no problem to use them in separate windows/devices.
Color is stored in OdGiSubEntityTraits ( method colour() ). Entities set property here start drawing.
If you're using the static libraries configuration, you must also register OdOleItemHandler in the static module map:
#if !defined(_TOOLKIT_IN_DLL_) || defined(__MWERKS__) ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(ModelerModule); ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(ExRasterModule); ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(OdRasterProcessingServicesImpl); ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(OdOleItemHandlerModuleImpl); ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(WinGDIModule); ODRX_BEGIN_STATIC_MODULE_MAP() ODRX_DEFINE_STATIC_APPLICATION(OD_T("ModelerGeometry"), ModelerModule) ODRX_DEFINE_STATIC_APPLICATION(OD_T("RxRasterServices"), ExRasterModule) ODRX_DEFINE_STATIC_APPLICATION(OD_T("RasterProcessor"), OdRasterProcessingServicesImpl) ODRX_DEFINE_STATIC_APPLICATION(OD_T("OdOleItemHandler"), OdOleItemHandlerModuleImpl) ODRX_DEFINE_STATIC_APPLICATION(OdWinGDIModuleName, WinGDIModule) ODRX_END_STATIC_MODULE_MAP() #endif
For a dynamic libraries configuration, OdOleItemHandler is loaded automatically if this .tx file is available in the program folder.
The easiest way is to call the worldDraw() method of the proxy entity.
ODA SDKs don't support per-face transparency for OdDbPolyFaceMesh. Transparency on an entire OdDbPolyFaceMesh entity can be set instead.
You can control the vectorizer triangulation count for shells using the following code:
ModelerModulePtr pM = odrxDynamicLinker()->loadModule(OdModelerGeometryModuleName, false); wrTriangulationParams TriangulationParams; TriangulationParams.normalTolerance = 0.5; TriangulationParams.PointsPerEdge = 1000; TriangulationParams.BetweenKnots = 100; TEST_ASSERT(eOk == pM->setTriangulationParams(TriangulationParams));
Also you can check the OdaMfcApp sample: Tools->Options->Triangulation Params.
Vectorization is a process of converting database entity representation into a set of simple geometry primitives that could be used for rendering, exporting, etc. For example, a circle entity could be converted into a set of line segments, text could be tessellated into a set of triangles, etc.
Exploding is a process of subdividing database entities into simpler database entities. For example, a custom entity with text and circle geometry could be exploded into circle and text entities, but the explosion process does not change the type of entity geometry. For example, a circle and text cannot be exploded further because they are the simplest primitives themselves.