Esempio n. 1
0
            void LerpGenerator::AddToTextureBuffer(TextureBuffer& Buffer) const
            {
                const Whole TargetWidth = Buffer.GetWidth();
                const Whole TargetHeight = Buffer.GetHeight();
                if( TargetWidth > this->FirstTexture->GetWidth() || TargetHeight > this->FirstTexture->GetHeight() ) {
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"The FirstTexture provided for LERP is not large enough to lerp onto the target texture.");
                }
                if( TargetWidth > this->SecondTexture->GetWidth() || TargetHeight > this->SecondTexture->GetHeight() ) {
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"The SecondTexture provided for LERP is not large enough to lerp onto the target texture.");
                }

                for( Whole Y = 0 ; Y < TargetHeight ; ++Y )
                {
                    for( Whole X = 0 ; X < TargetWidth ; ++X )
                    {
                        ColourValue FirstColour = this->FirstTexture->GetPixel(X,Y);
                        ColourValue SecondColour = this->SecondTexture->GetPixel(X,Y);

                        /*ColourValue TargetColour( FirstColour.RedChannel * ( 1.0 - this->InterpolateAmount ) + SecondColour.RedChannel * this->InterpolateAmount,
                                                  FirstColour.GreenChannel * ( 1.0 - this->InterpolateAmount ) + SecondColour.GreenChannel * this->InterpolateAmount,
                                                  FirstColour.BlueChannel * ( 1.0 - this->InterpolateAmount ) + SecondColour.BlueChannel * this->InterpolateAmount,
                                                  FirstColour.AlphaChannel * ( 1.0 - this->InterpolateAmount ) + SecondColour.AlphaChannel * this->InterpolateAmount);// */
                        LinearInterpolator<Real> Interpolator;
                        ColourValue TargetColour( Interpolator.InterpolateMath(FirstColour.RedChannel,SecondColour.RedChannel,this->InterpolateAmount),
                                                  Interpolator.InterpolateMath(FirstColour.GreenChannel,SecondColour.GreenChannel,this->InterpolateAmount),
                                                  Interpolator.InterpolateMath(FirstColour.BlueChannel,SecondColour.BlueChannel,this->InterpolateAmount),
                                                  Interpolator.InterpolateMath(FirstColour.AlphaChannel,SecondColour.AlphaChannel,this->InterpolateAmount) );
                        Buffer.SetPixel(X,Y,TargetColour);
                    }
                }
            }
Esempio n. 2
0
        void ParticleAffector::ProtoDeSerializeCustomParameters(const XML::Node& SelfRoot)
        {
            XML::Attribute CurrAttrib;
            XML::Node CustomParametersNode = SelfRoot.GetChild( ParticleAffector::GetSerializableName() + "CustomParameters" );

            if( !CustomParametersNode.Empty() ) {
                if(CustomParametersNode.GetAttribute("Version").AsInt() == 1) {
                    String ParamName, ParamValue;

                    for( XML::NodeIterator ParamIt = CustomParametersNode.begin() ; ParamIt != CustomParametersNode.end() ; ++ParamIt )
                    {
                        if( !(*ParamIt).Empty() ) {
                            if((*ParamIt).GetAttribute("Version").AsInt() == 1) {
                                CurrAttrib = (*ParamIt).GetAttribute("ParamName");
                                if( !CurrAttrib.Empty() )
                                    ParamName = CurrAttrib.AsString();

                                CurrAttrib = (*ParamIt).GetAttribute("ParamValue");
                                if( !CurrAttrib.Empty() )
                                    ParamValue = CurrAttrib.AsString();

                                if( !ParamName.empty() && !ParamValue.empty() ) {
                                    this->SetCustomParam(ParamName,ParamValue);
                                }
                            }
                        }
                    }
                }else{
                    MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (ParticleAffector::GetSerializableName() + "CustomParameters" ) + ": Not Version 1.");
                }
            }else{
                MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,ParticleAffector::GetSerializableName() + "CustomParameters" + " was not found in the provided XML node, which was expected.");
            }
        }
Esempio n. 3
0
    void WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
    {
        XML::Attribute CurrAttrib;
        XML::Node PropertiesNode = SelfRoot.GetChild( WorldProxy::GetSerializableName() + "Properties" );

        if( !PropertiesNode.Empty() ) {
            if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
                CurrAttrib = PropertiesNode.GetAttribute("ProxyID");
                if( !CurrAttrib.Empty() )
                    this->ProxyID = static_cast<UInt32>( CurrAttrib.AsUint() );

                XML::Node PositionNode = PropertiesNode.GetChild("Location").GetFirstChild();
                if( !PositionNode.Empty() ) {
                    Vector3 Loc(PositionNode);
                    this->SetLocation(Loc);
                }

                XML::Node OrientationNode = PropertiesNode.GetChild("Orientation").GetFirstChild();
                if( !PositionNode.Empty() ) {
                    Quaternion Rot(OrientationNode);
                    this->SetOrientation(Rot);
                }

                XML::Node ScaleNode = PropertiesNode.GetChild("Scale").GetFirstChild();
                if( !PositionNode.Empty() ) {
                    Vector3 Scale(ScaleNode);
                    this->SetScale(Scale);
                }
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (WorldProxy::GetSerializableName() + "Properties" ) + ": Not Version 1.");
            }
        }else{
            MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,WorldProxy::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
        }
    }
Esempio n. 4
0
        void Widget::ProtoDeSerializeEvents(const XML::Node& SelfRoot)
        {
            this->RemoveAllEvents();

            XML::Attribute CurrAttrib;
            XML::Node EventsNode = SelfRoot.GetChild( "Events" );

            if( !EventsNode.Empty() ) {
                if( EventsNode.GetAttribute("Version").AsInt() == 1 ) {
                    for( XML::NodeIterator EvNodeIt = EventsNode.begin() ; EvNodeIt != EventsNode.end() ; ++EvNodeIt )
                    {
                        if( (*EvNodeIt).GetAttribute("Version").AsInt() == 1 ) {
                            String EvName;

                            CurrAttrib = (*EvNodeIt).GetAttribute("Name");
                            if( !CurrAttrib.Empty() )
                                EvName = CurrAttrib.AsString();

                            if( !EvName.empty() ) {
                                this->AddEvent(EvName);
                            }
                        }else{
                            MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("Events") + ": Not Version 1.");
                        }
                    }
                }else{
                    MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + String("Events") + ": Not Version 1.");
                }
            }
        }
Esempio n. 5
0
    void GravityWell::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
    {
        this->AreaEffect::ProtoDeSerializeProperties(SelfRoot);

        XML::Attribute CurrAttrib;
        XML::Node PropertiesNode = SelfRoot.GetChild( GravityWell::GetSerializableName() + "Properties" );

        if( !PropertiesNode.Empty() ) {
            if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
                CurrAttrib = PropertiesNode.GetAttribute("AttenAmount");
                if( !CurrAttrib.Empty() )
                    this->SetAttenuationAmount( CurrAttrib.AsReal() );

                CurrAttrib = PropertiesNode.GetAttribute("AttenStyle");
                if( !CurrAttrib.Empty() )
                    this->SetAttenuationStyle( static_cast<Mezzanine::AttenuationStyle>( CurrAttrib.AsWhole() ) );

                CurrAttrib = PropertiesNode.GetAttribute("Strength");
                if( !CurrAttrib.Empty() )
                    this->SetFieldStrength( CurrAttrib.AsReal() );

                CurrAttrib = PropertiesNode.GetAttribute("AllowWorldGravity");
                if( !CurrAttrib.Empty() )
                    this->SetAllowWorldGravity( StringTools::ConvertToBool( CurrAttrib.AsString() ) );
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (GravityWell::GetSerializableName() + "Properties" ) + ": Not Version 1.");
            }
        }else{
            MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,GravityWell::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
        }
    }
Esempio n. 6
0
 Boole CreateDirectory(const String& DirectoryPath)
 {
     #ifdef MEZZ_WINDOWS
     if( ::CreateDirectoryA(DirectoryPath.c_str(),NULL) < 0 ) {
         if( ERROR_ALREADY_EXISTS == ::GetLastError() ) {
             return false;
         }
         StringStream ExceptionStream;
         ExceptionStream << "Unable to create directory.  Error follows:" << std::endl;
         if( ERROR_PATH_NOT_FOUND == ::GetLastError() ) {
             ExceptionStream << "Path to requested directory does not exist.";
         }else{
             ExceptionStream << "Error Unknown. :(";
         }
         MEZZ_EXCEPTION(ExceptionBase::IO_DIRECTORY_NOT_FOUND_EXCEPTION,ExceptionStream.str());
     }
     return true;
     #else
     if( ::mkdir(DirectoryPath.c_str(),0777) < 0 ) {
         if( EEXIST == errno ) {
             return false;
         }
         StringStream ExceptionStream;
         ExceptionStream << "Unable to create directory.  Error follows:" << std::endl;
         ExceptionStream << std::strerror(errno);
         MEZZ_EXCEPTION(ExceptionBase::IO_DIRECTORY_NOT_FOUND_EXCEPTION,ExceptionStream.str());
     }
     return true;
     #endif
 }
Esempio n. 7
0
        void TextureAtlasHandler::LoadAtlasFromFile(const String& Name, const String& Group)
        {
            /// @todo Update after we have refactored the resource system if needed.
            Resource::DataStreamPtr AtlasStream = Resource::ResourceManager::GetSingletonPtr()->OpenAssetStream(Name,Group);
            AtlasStream->SetStreamPosition(0);
            XML::Document AtlasDoc;
            AtlasDoc.Load( *AtlasStream.Get() );

            XML::Node RootNode = AtlasDoc.GetChild("Atlases");
            if( !RootNode.Empty() )
            {
                for( XML::NodeIterator AtlasIt = RootNode.begin() ; AtlasIt != RootNode.end() ; ++AtlasIt )
                {
                    // Parse the Atlas
                    TextureAtlas* NewAtlas = new TextureAtlas( (*AtlasIt) );
                    // Verify we don't already have one of the same name
                    AtlasIterator AtIt = this->Atlases.find( NewAtlas->GetName() );
                    if( AtIt != Atlases.end() )
                    {
                        MEZZ_EXCEPTION(ExceptionBase::II_DUPLICATE_IDENTITY_EXCEPTION,"Texture Atlas with the name \"" + NewAtlas->GetName() + "\" already exists.");
                    }
                    // Add the unique Atlas
                    this->Atlases[NewAtlas->GetName()] = NewAtlas;
                }
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Mezzanine Texture Atlas file \"" + Name + "\"does not contain expected \"Atlases\" root node.  File is not valid and cannot be parsed.");
            }
        }
Esempio n. 8
0
void HorizontalScrollbar::ProtoDeSerializeChildQuads(const XML::Node& SelfRoot)
{
    this->QuadRenderable::ProtoDeSerializeChildQuads(SelfRoot);

    // Assign the ScrollBack
    this->ScrollBack = static_cast<Button*>( this->GetChild(this->Name+".ScrollBack") );
    if( this->ScrollBack == NULL ) {
        MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"ScrollBack button not found after HorizontalScrollbar deserialization.");
    }

    // Assign the Scroller
    this->Scroller = static_cast<Button*>( this->GetChild(this->Name+".Scroller") );
    if( this->Scroller == NULL ) {
        MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Scroller button not found after HorizontalScrollbar deserialization.");
    }

    if( this->GetNumChildren() > 2 )
    {
        // Assign the LeftButton
        this->UpLeftButton = static_cast<Button*>( this->GetChild(this->Name+".LeftButton") );
        if( this->UpLeftButton == NULL ) {
            MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"LeftButton button not found after HorizontalScrollbar deserialization.");
        }

        // Assign the RightButton
        this->DownRightButton = static_cast<Button*>( this->GetChild(this->Name+".RightButton") );
        if( this->DownRightButton == NULL ) {
            MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"RightButton button not found after HorizontalScrollbar deserialization.");
        }
    }

    this->SubscribeToChildEvents();
}
Esempio n. 9
0
 void SequenceContainer::VerifyInputSequence(const MetaCodeContainer& Codes) const
 {
     const Input::MetaCode NullCode;
     if( Codes.size() < 3 ) {
         MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Attempting to add a Sequenced Input that is less then 3 MetaCodes long(including the Null MetaCode).  "
                                                                "A sequence with only one(or less) actual MetaCode isn't a sequence.");
     }
     if( NullCode != Codes.back() )
         { MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Attempting to add a Sequenced Input that is not terminated with a null MetaCode."); }
 }
Esempio n. 10
0
            TubeGenerator& TubeGenerator::SetOuterRadius(const Real OuterRadius)
            {
                if( OuterRadius <= 0.0 )
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Radius for a generated tube mesh must be greater than zero.");

                if( OuterRadius < this->TubeInnerRadius )
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Outer radius must be larger than inner radius!");

                this->TubeOuterRadius = OuterRadius;
                return *this;
            }
Esempio n. 11
0
 void Transform::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if ( Mezzanine::String(OneNode.Name())==Mezzanine::String(SerializableName()) )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             this->Location.ProtoDeSerialize(OneNode.GetChild("Vector3"));
             this->Rotation.ProtoDeSerialize(OneNode.GetChild("Quaternion"));
         }else{
             MEZZ_EXCEPTION(Exception::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + SerializableName() + ": Not Version 1.");
         }
     }else{
         MEZZ_EXCEPTION(Exception::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + SerializableName() + ", found a " + String(OneNode.Name()));
     }
 }
Esempio n. 12
0
    void Entresol::DestroyAllManagers()
    {
        //for( std::list<ManagerBase*>::iterator iter = --this->ManagerList.end(); !ManagerList.empty(); iter = --this->ManagerList.end() ) //Backward
        /*for( std::list<ManagerBase*>::iterator iter = this->ManagerList.begin(); !ManagerList.empty(); iter = this->ManagerList.begin() ) //forward
        {
            ManagerBase* Current = (*iter);
            #ifdef MEZZDEBUG
            this->Log("Deleting " + Current->GetInterfaceTypeAsString() + ".");
            this->DoMainLoopLogging();
            #endif
            ManagerFactoryIterator ManIt = this->ManagerFactories.find(Current->GetImplementationTypeName());
            if( ManIt == this->ManagerFactories.end() ) {
                MEZZ_EXCEPTION(Exception::II_IDENTITY_NOT_FOUND_EXCEPTION,"Attempting to destroy manager of type \"" + Current->GetImplementationTypeName() + "\", which has no factory registered.");
            }else{
                (*ManIt).second->DestroyManager(Current);
            }
        }
        this->ManagerList.clear();//*/
        while( !(this->ManagerList.empty()) )
        {
            ManagerBase* Current = this->ManagerList.front();
            #ifdef MEZZDEBUG
            this->Log("Deleting " + Current->GetInterfaceTypeAsString() + ".");
            #endif

            ManagerFactoryIterator ManIt = this->ManagerFactories.find(Current->GetImplementationTypeName());
            if( ManIt == this->ManagerFactories.end() ) {
                MEZZ_EXCEPTION(Exception::II_IDENTITY_NOT_FOUND_EXCEPTION,"Attempting to destroy manager of type \"" + Current->GetImplementationTypeName() + "\", which has no factory registered.");
            }else{
                (*ManIt).second->DestroyManager(Current);
            }

            this->ManagerList.pop_front();
        }//*/
    }
Esempio n. 13
0
    bool Entresol::VerifyManagerInitializations()
    {
        std::vector<String> ManagerNames;
        for (std::list< ManagerBase* >::iterator Iter=this->ManagerList.begin(); Iter!=this->ManagerList.end(); ++Iter )
        {
            if(!(*Iter)->IsInitialized())
            {
                ManagerNames.push_back( (*Iter)->GetInterfaceTypeAsString() );
            }
        }

        if(ManagerNames.empty())
        {
            return true;
        }else{
            StringStream ExceptionStream;
            if(1 == ManagerNames.size())
            {
                ExceptionStream << "Manager: ";
                ExceptionStream << ManagerNames.at(0);
                ExceptionStream << "is not initialized.  All managers need to be initiailzed when entering the main loop.";
            }else{
                ExceptionStream << "Managers: ";
                for( std::vector<String>::iterator Iter = ManagerNames.begin() ; Iter != ManagerNames.end() ; ++Iter )
                {
                    ExceptionStream << (*Iter) << ", ";
                }
                ExceptionStream << "are not initialized.  All managers need to be initiailzed when entering the main loop.";
            }
            MEZZ_EXCEPTION(Exception::INVALID_STATE_EXCEPTION,ExceptionStream.str());
            return false;
        }
    }
Esempio n. 14
0
 Entresol::Entresol(const String& EngineDataPath, const Mezzanine::ArchiveType ArchType, const String& InitializerFile)
 {
     if(String::npos != InitializerFile.find(".mxi"))
         { ConstructFromXML(EngineDataPath, ArchType, InitializerFile); }
     else
         { MEZZ_EXCEPTION(Exception::NOT_IMPLEMENTED_EXCEPTION,"Attempting to initialze Mezzanine from an unsupported file type."); }
 }
Esempio n. 15
0
CapsuleCollisionShape::CapsuleCollisionShape(XML::Node OneNode)
{
    if(OneNode.GetAttribute("Version").AsInt() == 1)
    {
        XML::Attribute OneName = OneNode.GetChild("PrimitiveCollisionShape").GetChild("CollisionShape").GetAttribute("Name");               // get name
        if(!OneName) {
            MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Could not find Name Attribute on CollsionShape Node during preparation for deserialization");
        }
        String Name_(OneName.AsString());

        XML::Attribute Axis = OneNode.GetAttribute("Axis");
        if (!Axis) {
            DeSerializeError("find Axis Attribute",CapsuleCollisionShape::GetSerializableName());
        }
        /*
        XML::Attribute Radius = OneNode.GetAttribute("Radius");
        if (!Radius) { DeSerializeError("find Radius Attribute",CapsuleCollisionShape::GetSerializableName()); }
        XML::Attribute Height = OneNode.GetAttribute("Height");
        if (!Height) { DeSerializeError("find Height Attribute",CapsuleCollisionShape::GetSerializableName()); }
        //SetPointers(new CapsuleCollisionShape(Name_,Radius.AsReal(),Height.AsReal(), (StandardAxis)Axis.AsInteger());  // make and deserialize the shape
        this->Construct(Name_,Radius.AsReal(),Height.AsReal(),(StandardAxis)Axis.AsInteger());
        */
        this->Construct(Name_,0,0,(StandardAxis)Axis.AsInteger());

        this->ProtoDeSerialize(OneNode);

    } else {
        DeSerializeError("find usable serialization version",CapsuleCollisionShape::GetSerializableName());
    }
}
Esempio n. 16
0
 void CollisionShapeManager::LoadAllShapesFromBinaryFile(const String& FileName, const String& Group)
 {
     btBulletWorldImporter Importer;
     Ogre::DataStreamPtr Stream = Ogre::ResourceGroupManager::getSingleton().openResource(FileName,Group);
     char* buffer = new char[Stream->size()];
     Stream->read((void*)buffer, Stream->size());
     if(!Importer.loadFileFromMemory(buffer, Stream->size()))
     {
         MEZZ_EXCEPTION(ExceptionBase::IO_FILE_EXCEPTION,"Failed to load file: " + FileName + ".")
     }
     delete[] buffer;
     for( Whole X = 0 ; X < Importer.getNumCollisionShapes() ; ++X )
     {
         btCollisionShape* Shape = Importer.getCollisionShapeByIndex(X);
         const char* MaybeAName = Importer.getNameForPointer((void*)Shape);
         String Name;
         if(MaybeAName)
         {
             Name = String(MaybeAName);
             ShapeMapIterator it = this->CollisionShapes.find(Name);
             if(it == this->CollisionShapes.end())
             {
                 CollisionShape* NewShape = this->WrapShape(Name,Shape);
                 this->CollisionShapes.insert( std::pair<String,CollisionShape*>(Name,NewShape) );
             }
         }else{
             static Whole NameCount = 0;
             Name = String("Unnamed") += StringTools::ConvertToString(NameCount++);
             CollisionShape* NewShape = this->WrapShape(Name,Shape);
             this->UnnamedShapes.push_back(NewShape);
         }
     }
 }
Esempio n. 17
0
        String GetLocalAppDataDir()
        {
            #ifdef MEZZ_WINDOWS
            TCHAR path_local_appdata[MAX_PATH];
            if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, path_local_appdata))) {
                return path_local_appdata;
            }
            #else
            struct passwd* pw = getpwuid(getuid());
            if(pw) {
                return String(pw->pw_dir);
            }else{
                MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Could not get user information to retrieve app data directory.");
            }

            // might be some useful MAC OS X code
            /*#elif MEZZ_MACOSX
            FSRef ref;
            OSType folderType = kApplicationSupportFolderType;
            char path[PATH_MAX];
            FSFindFolder( kUserDomain, folderType, kCreateFolder, &ref );
            FSRefMakePath( &ref, (UInt8*)&path, PATH_MAX );
            return path;*/
            #endif
            return "";
        }
Esempio n. 18
0
        Vector3 ConeCollisionShape::GetAxisMathBS() const
        {
            Vector3 Results;
            switch (GetUpStandardAxis())
            {
                case 0:
                        Results[0] = 1;
                        Results[1] = 0;
                        Results[2] = 2;
                    break;
                case 1:
                        Results[0] = 0;
                        Results[1] = 1;
                        Results[2] = 2;
                    break;
                case 2:
                        Results[0] = 0;
                        Results[1] = 2;
                        Results[2] = 1;
                    break;
                default:
                    { MEZZ_EXCEPTION(Exception::PARAMETERS_EXCEPTION,"Non-supported up StandardAxis passed into ConeCollisionShape::GetAxisMathBS()."); }
            }

            return Results;
        }
Esempio n. 19
0
 // DeSerializable
 void ColourValue::ProtoDeSerialize(const XML::Node& OneNode)
 {
     if( Mezzanine::String(OneNode.Name())==this->ColourValue::GetSerializableName() )
     {
         if(OneNode.GetAttribute("Version").AsInt() == 1)
         {
             this->RedChannel=OneNode.GetAttribute("Red").AsReal();
             this->GreenChannel=OneNode.GetAttribute("Green").AsReal();
             this->BlueChannel=OneNode.GetAttribute("Blue").AsReal();
             this->AlphaChannel=OneNode.GetAttribute("Alpha").AsReal();
         }else{
             MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (this->ColourValue::GetSerializableName()) + ": Not Version 1");
         }
     }else{
         MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_INVALID_EXCEPTION,"Attempting to deserialize a " + (this->ColourValue::GetSerializableName()) + ", found a " + OneNode.Name());
     }
 }
Esempio n. 20
0
            ConeGenerator& ConeGenerator::SetRadius(const Real Radius)
            {
                if( Radius <= 0.0 )
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Radius for a generated cone mesh must be greater than zero.");

                this->ConeRadius = Radius;
                return *this;
            }
Esempio n. 21
0
 void RemoveDirectory(const String& DirectoryPath)
 {
     if( !rmdir(DirectoryPath.c_str()) ) {
         return;
     }else{
         MEZZ_EXCEPTION(ExceptionBase::IO_DIRECTORY_NOT_FOUND_EXCEPTION,"Unknown error removing directory.");
     }
 }
Esempio n. 22
0
 Logger& Entresol::GetLogStream(Threading::Thread::id ID)
 {
     Threading::FrameScheduler::Resource* AlmostResults = this->WorkScheduler.GetThreadResource(ID);
     if(AlmostResults)
         { return AlmostResults->GetUsableLogger(); }
     else
         { MEZZ_EXCEPTION(Exception::PARAMETERS_RANGE_EXCEPTION, "Could not access thread Specific Logger from invalid thread."); }
 }
Esempio n. 23
0
        void GraphicsManager::SetRenderSystem(const Graphics::RenderSystem& RenderSys, Boole InitializeRenderSystem)
        {
            if(!this->OgreBeenInitialized) this->CurrRenderSys = RenderSys;
            else { MEZZ_EXCEPTION(ExceptionBase::INVALID_STATE_EXCEPTION,"Attempting to set RenderSystem after graphics has been initialized.  This is not supported."); }

            if( InitializeRenderSystem )
                this->InitOgreRenderSystem();
        }
Esempio n. 24
0
            TubeGenerator& TubeGenerator::SetHeight(const Real Height)
            {
                if( Height <= 0.0 )
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Height for a generated cylinder mesh must be greater than zero.");

                this->TubeHeight = Height;
                return *this;
            }
Esempio n. 25
0
            TubeGenerator& TubeGenerator::SetNumSegCircle(const Whole SegCircle)
            {
                if( SegCircle < 3 )
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Number of segments for circular component of generated tube mesh must be greater than two.");

                this->NumSegCircle = SegCircle;
                return *this;
            }
Esempio n. 26
0
            TubeGenerator& TubeGenerator::SetNumSegHeight(const Whole SegHeight)
            {
                if( SegHeight == 0 )
                    MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Number of segments for length component of generated tube mesh must be greater than zero.");

                this->NumSegHeight = SegHeight;
                return *this;
            }
Esempio n. 27
0
TorusGenerator& TorusGenerator::SetToroidalRadius(const Real ToroidalRadius)
{
    if( ToroidalRadius <= 0.0 )
        MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Radius for Toroidal ring of a generated torus mesh must be greater than zero.");

    this->TorusToroidalRadius = ToroidalRadius;
    return *this;
}
Esempio n. 28
0
TorusGenerator& TorusGenerator::SetNumToroidalSeg(const Whole ToroidalSeg)
{
    if( ToroidalSeg < 3 )
        MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Number of segments for Toroidal ring of generated torus mesh must be greater than two.");

    this->NumToroidalSeg = ToroidalSeg;
    return *this;
}
Esempio n. 29
0
        void SimpleRenderer::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
        {
            XML::Attribute CurrAttrib;
            XML::Node PropertiesNode = SelfRoot.GetChild( SimpleRenderer::GetSerializableName() + "Properties" );

            if( !PropertiesNode.Empty() ) {
                if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
                    CurrAttrib = PropertiesNode.GetAttribute("PriAtlas");
                    if( !CurrAttrib.Empty() )
                        this->PriAtlas = CurrAttrib.AsString();
                }else{
                    MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (SimpleRenderer::GetSerializableName() + "Properties") + ": Not Version 1.");
                }
            }else{
                MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,SimpleRenderer::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
            }
        }
Esempio n. 30
0
 void ChangeWorkingDirectory(const String& ChangeTo)
 {
     #ifdef MEZZ_WINDOWS
     if(_chdir(ChangeTo.c_str()))
     #else
     if(chdir(ChangeTo.c_str()))
     #endif
     { MEZZ_EXCEPTION(ExceptionBase::IO_DIRECTORY_NOT_FOUND_EXCEPTION,String("Could not change to directory \"")+ChangeTo+"\" error: "+ToString(errno)); }
 }