mirror of https://github.com/Poikilos/b3view
make origin axis widget toggleable
parent
036c0feb01
commit
e29565a110
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,14 +1,18 @@
|
|||
# Changelog
|
||||
|
||||
## [git] - 2019-04-18
|
||||
## [git] - 2019-04-19
|
||||
(poikilos)
|
||||
### Added
|
||||
* box for axis length (size of the axis widget)
|
||||
* box for frame rate
|
||||
* Camera Target widget
|
||||
* option for turning off origin axis widget
|
||||
|
||||
### Changed
|
||||
* Reorder boxes.
|
||||
* Changed hotkeys so they aren't triggered when typing in the panel.
|
||||
* Reorder items on panel.
|
||||
* Hotkeys are different so they're not triggered when typing in the
|
||||
panel.
|
||||
* Don't reset yaw nor camera distance when panning
|
||||
|
||||
## [git] - 2019-04-08
|
||||
(poikilos)
|
||||
|
|
58
Engine.cpp
58
Engine.cpp
|
@ -59,15 +59,14 @@ void Engine::drawAxisLines()
|
|||
zMaterial.EmissiveColor = SColor(255, 0, 0, 255);
|
||||
|
||||
SMaterial descenderMaterialVert(xMaterial);
|
||||
descenderMaterialVert.EmissiveColor = SColor(128, 128, 128, 128); // ARGB
|
||||
descenderMaterialVert.EmissiveColor = SColor(128, 100, 140, 190); // ARGB
|
||||
SMaterial descenderMaterialHorz(xMaterial);
|
||||
descenderMaterialHorz.EmissiveColor = SColor(255, 255, 255, 255);
|
||||
|
||||
vector3df descend3df(0, 0, 0);
|
||||
// vector3df target = m_View->c
|
||||
|
||||
bool enableAxisWidget = true;
|
||||
m_Driver->setTransform(ETS_WORLD, matrix4());
|
||||
|
||||
if (m_View != nullptr) {
|
||||
if (this->m_UserInterface->viewMenu->isItemChecked(this->m_UserInterface->viewTargetIdx)) {
|
||||
if (m_View->zUp()) {
|
||||
|
@ -119,37 +118,39 @@ void Engine::drawAxisLines()
|
|||
// m_AxisFont->draw(L"target", rect<s32>(targetPos2d, textSize), descenderMaterial.EmissiveColor, true, true);
|
||||
// }
|
||||
}
|
||||
enableAxisWidget = this->m_UserInterface->viewMenu->isItemChecked(this->m_UserInterface->viewAxisWidgetIdx);
|
||||
}
|
||||
|
||||
|
||||
if (enableAxisWidget) {
|
||||
m_Driver->setMaterial(xMaterial);
|
||||
m_Driver->draw3DLine(vector3df(), vector3df(axisLength, 0, 0), SColor(255, 255, 0, 0));
|
||||
position2d<s32> textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(vector3df(axisLength + axisLength*.1f, 0, 0));
|
||||
dimension2d<u32> textSize;
|
||||
if (m_AxisFont != nullptr) {
|
||||
textSize = m_AxisFont->getDimension(L"X+");
|
||||
m_AxisFont->draw(L"X+", rect<s32>(textPos, textSize), SColor(255, 255, 0, 0), true, true);
|
||||
}
|
||||
|
||||
m_Driver->setMaterial(xMaterial);
|
||||
m_Driver->draw3DLine(vector3df(), vector3df(axisLength, 0, 0), SColor(255, 255, 0, 0));
|
||||
position2d<s32> textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(vector3df(axisLength + axisLength*.1f, 0, 0));
|
||||
dimension2d<u32> textSize;
|
||||
if (m_AxisFont != nullptr) {
|
||||
textSize = m_AxisFont->getDimension(L"X+");
|
||||
m_AxisFont->draw(L"X+", rect<s32>(textPos, textSize), SColor(255, 255, 0, 0), true, true);
|
||||
}
|
||||
m_Driver->setMaterial(yMaterial);
|
||||
m_Driver->draw3DLine(vector3df(), vector3df(0, axisLength, 0), SColor(255, 0, 255, 0));
|
||||
textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(vector3df(0, axisLength + axisLength*.1f, 0));
|
||||
if (m_AxisFont != nullptr) {
|
||||
textSize = m_AxisFont->getDimension(L"Y+");
|
||||
m_AxisFont->draw(L"Y+", rect<s32>(textPos, textSize), SColor(255, 0, 255, 0), true, true);
|
||||
}
|
||||
|
||||
m_Driver->setMaterial(yMaterial);
|
||||
m_Driver->draw3DLine(vector3df(), vector3df(0, axisLength, 0), SColor(255, 0, 255, 0));
|
||||
textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(vector3df(0, axisLength + axisLength*.1f, 0));
|
||||
if (m_AxisFont != nullptr) {
|
||||
textSize = m_AxisFont->getDimension(L"Y+");
|
||||
m_AxisFont->draw(L"Y+", rect<s32>(textPos, textSize), SColor(255, 0, 255, 0), true, true);
|
||||
m_Driver->setMaterial(zMaterial);
|
||||
m_Driver->draw3DLine(vector3df(), vector3df(0, 0, axisLength), SColor(255, 0, 0, 255));
|
||||
textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(vector3df(0, 0, axisLength + axisLength*.1f));
|
||||
if (m_AxisFont != nullptr) {
|
||||
textSize = m_AxisFont->getDimension(L"Z+");
|
||||
m_AxisFont->draw(L"Z+", rect<s32>(textPos, textSize), SColor(255, 0, 0, 255), true, true);
|
||||
}
|
||||
//delete xMaterial;
|
||||
//delete yMaterial;
|
||||
//delete zMaterial;
|
||||
}
|
||||
|
||||
m_Driver->setMaterial(zMaterial);
|
||||
m_Driver->draw3DLine(vector3df(), vector3df(0, 0, axisLength), SColor(255, 0, 0, 255));
|
||||
textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(vector3df(0, 0, axisLength + axisLength*.1f));
|
||||
if (m_AxisFont != nullptr) {
|
||||
textSize = m_AxisFont->getDimension(L"Z+");
|
||||
m_AxisFont->draw(L"Z+", rect<s32>(textPos, textSize), SColor(255, 0, 0, 255), true, true);
|
||||
}
|
||||
//delete xMaterial;
|
||||
//delete yMaterial;
|
||||
//delete zMaterial;
|
||||
}
|
||||
|
||||
void Engine::drawBackground()
|
||||
|
@ -285,6 +286,7 @@ void Engine::loadMesh(const wstring& fileName)
|
|||
|
||||
irr::scene::IAnimatedMesh* mesh = m_Scene->getMesh(fileName.c_str());
|
||||
if (mesh != nullptr) {
|
||||
m_Device->setWindowCaption(( wstring(L"b3view - ") + fileName).c_str());
|
||||
m_LoadedMesh = m_Scene->addAnimatedMeshSceneNode(mesh);
|
||||
Utility::dumpMeshInfoToConsole(m_LoadedMesh);
|
||||
if (Utility::toLower(Utility::extensionOf(fileName)) == L"3ds") {
|
||||
|
|
|
@ -37,22 +37,23 @@ void UserInterface::setupUserInterface()
|
|||
fileMenu = menu->getSubMenu(0);
|
||||
fileMenu->addItem(L"Open", UIC_FILE_OPEN);
|
||||
fileMenu->addItem(L"Change Texture", UIC_FILE_OPEN_TEXTURE);
|
||||
fileMenu->addItem(L"Previous Texture Shift F3", UIC_FILE_PREVIOUS_TEXTURE);
|
||||
fileMenu->addItem(L"Next Texture F3", UIC_FILE_NEXT_TEXTURE);
|
||||
fileMenu->addItem(L"Previous Texture Shift F3", UIC_FILE_PREVIOUS_TEXTURE);
|
||||
fileMenu->addItem(L"Next Texture F3", UIC_FILE_NEXT_TEXTURE);
|
||||
fileMenu->addItem(L"Quit", UIC_FILE_QUIT);
|
||||
|
||||
// View Menu
|
||||
viewMenu = menu->getSubMenu(1);
|
||||
viewWireframeIdx = viewMenu->addItem(L"Wireframe", UIC_VIEW_WIREFRAME, true, false, this->m_WireframeDisplay, true);
|
||||
viewLightingIdx = viewMenu->addItem(L"Lighting", UIC_VIEW_LIGHTING, true, false, this->m_Lighting, true);
|
||||
viewTargetIdx = viewMenu->addItem(L"Camera Target", UIC_VIEW_TARGET, true, false, true, true);
|
||||
viewAxisWidgetIdx = viewMenu->addItem(L"Origin Axis Widget", UIC_VIEW_AXIS_WIDGET, true, false, true, true);
|
||||
viewTargetIdx = viewMenu->addItem(L"Camera Target", UIC_VIEW_TARGET, true, false, false, true);
|
||||
|
||||
viewTextureInterpolationIdx = viewMenu->addItem(L"Texture Interpolation Ctrl i", UIC_VIEW_TEXTURE_INTERPOLATION, true, false, this->m_TextureInterpolation, true);
|
||||
|
||||
viewYUpIdx = viewMenu->addItem(L"Y Up", UIC_VIEW_Y_UP, true, false, true, true);
|
||||
viewZUpIdx = viewMenu->addItem(L"Z Up", UIC_VIEW_Z_UP, true, false, false, true);
|
||||
viewMenu->addItem(L"Slower Ctrl Left", UIC_VIEW_SLOWER, true, false, false, false);
|
||||
viewMenu->addItem(L"Faster Ctrl Right", UIC_VIEW_FASTER, true, false, false, false);
|
||||
viewMenu->addItem(L"Slower Ctrl Left", UIC_VIEW_SLOWER, true, false, false, false);
|
||||
viewMenu->addItem(L"Faster Ctrl Right", UIC_VIEW_FASTER, true, false, false, false);
|
||||
|
||||
// Playback Control Window
|
||||
dimension2d<u32> windowSize = m_Engine->m_Driver->getScreenSize();
|
||||
|
|
|
@ -35,12 +35,13 @@ enum UserInterfaceCommands {
|
|||
UIC_FILE_PREVIOUS_TEXTURE = 1004,
|
||||
UIC_VIEW_WIREFRAME = 2001,
|
||||
UIC_VIEW_LIGHTING = 2002,
|
||||
UIC_VIEW_TARGET = 2003,
|
||||
UIC_VIEW_TEXTURE_INTERPOLATION = 2004,
|
||||
UIC_VIEW_Y_UP = 2005,
|
||||
UIC_VIEW_Z_UP = 2006,
|
||||
UIC_VIEW_SLOWER = 2007,
|
||||
UIC_VIEW_FASTER = 2008
|
||||
UIC_VIEW_AXIS_WIDGET = 2003,
|
||||
UIC_VIEW_TARGET = 2004,
|
||||
UIC_VIEW_TEXTURE_INTERPOLATION = 2005,
|
||||
UIC_VIEW_Y_UP = 2006,
|
||||
UIC_VIEW_Z_UP = 2007,
|
||||
UIC_VIEW_SLOWER = 2008,
|
||||
UIC_VIEW_FASTER = 2009
|
||||
};
|
||||
|
||||
class UserInterface : public irr::IEventReceiver {
|
||||
|
@ -76,6 +77,7 @@ public:
|
|||
irr::gui::IGUIEditBox* axisSizeEditBox;
|
||||
irr::u32 viewTextureInterpolationIdx;
|
||||
irr::u32 viewWireframeIdx;
|
||||
irr::u32 viewAxisWidgetIdx;
|
||||
irr::u32 viewLightingIdx;
|
||||
irr::u32 viewTargetIdx;
|
||||
irr::u32 viewYUpIdx;
|
||||
|
|
Loading…
Reference in New Issue