00001 /************************************************************************************ 00002 00003 Filename : Render_XmlSceneLoader.h 00004 Content : Imports and exports XML files 00005 Created : January 21, 2013 00006 Authors : Robotic Arm Software - Peter Hoff, Dan Goodman, Bryan Croteau 00007 00008 Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved. 00009 00010 Licensed under the Apache License, Version 2.0 (the "License"); 00011 you may not use this file except in compliance with the License. 00012 You may obtain a copy of the License at 00013 00014 http://www.apache.org/licenses/LICENSE-2.0 00015 00016 Unless required by applicable law or agreed to in writing, software 00017 distributed under the License is distributed on an "AS IS" BASIS, 00018 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 See the License for the specific language governing permissions and 00020 limitations under the License. 00021 00022 ************************************************************************************/ 00023 00024 #ifndef INC_Render_XMLSceneLoader_h 00025 #define INC_Render_XMLSceneLoader_h 00026 00027 #include "Render_Device.h" 00028 #include <Kernel/OVR_SysFile.h> 00029 using namespace OVR; 00030 using namespace OVR::Render; 00031 00032 #ifdef OVR_DEFINE_NEW 00033 #undef new 00034 #endif 00035 00036 #include "../../../3rdParty/TinyXml/tinyxml2.h" 00037 00038 namespace OVR { namespace Render { 00039 00040 using namespace tinyxml2; 00041 00042 class XmlHandler 00043 { 00044 public: 00045 XmlHandler(); 00046 ~XmlHandler(); 00047 00048 bool ReadFile(const char* fileName, OVR::Render::RenderDevice* pRender, 00049 OVR::Render::Scene* pScene, 00050 OVR::Array<Ptr<CollisionModel> >* pColisions, 00051 OVR::Array<Ptr<CollisionModel> >* pGroundCollisions); 00052 00053 protected: 00054 void ParseVectorString(const char* str, OVR::Array<OVR::Vector3f> *array, 00055 bool is2element = false); 00056 00057 private: 00058 tinyxml2::XMLDocument* pXmlDocument; 00059 char filePath[250]; 00060 int textureCount; 00061 OVR::Array<Ptr<Texture> > Textures; 00062 int modelCount; 00063 OVR::Array<Ptr<Model> > Models; 00064 int collisionModelCount; 00065 int groundCollisionModelCount; 00066 }; 00067 00068 }} // OVR::Render 00069 00070 #ifdef OVR_DEFINE_NEW 00071 #define new OVR_DEFINE_NEW 00072 #endif 00073 00074 #endif // INC_Render_XMLSceneLoader_h