Ejemplo n.º 1
0
	bool Shader::Save(void* wrapper)
	{
		StartObject(wrapper);

		SaveKey(wrapper, "name");
		SaveValue(wrapper, m_Name);

		SaveKey(wrapper, "type");
		SaveValue(wrapper, EnumUtil::ShaderTypeToString(m_Type));

		std::vector<ShaderTexture> enums;
		EnumUtil::GetShaderTextures(m_TextureFlags, enums);

		SaveKey(wrapper, "textures");
		SaveArray(wrapper, enums.size(), [&](unsigned int index)
		{
			SaveValue(wrapper, EnumUtil::ShaderTextureToString(enums[index]));
		});

		SaveKey(wrapper, "path");
		SaveValue(wrapper, m_FilePath);

		EndObject(wrapper);

		return true;
	}
Ejemplo n.º 2
0
	bool Texture::Save(void* wrapper)
	{
		StartObject(wrapper);

		SaveKey(wrapper, "name");
		SaveValue(wrapper, m_Name);
		SaveKey(wrapper, "format");
		SaveValue(wrapper, EnumUtil::TextureFormatToString(m_Format));
		SaveKey(wrapper, "type");
		SaveValue(wrapper, EnumUtil::TextureTypeToString(m_Type));
		SaveKey(wrapper, "filter");
		SaveValue(wrapper, EnumUtil::FilterModeToString(m_FilterMode));
		SaveKey(wrapper, "wrap");
		SaveValue(wrapper, EnumUtil::WrapModeToString(m_WrapMode));
		SaveKey(wrapper, "width");
		SaveValue(wrapper, m_Width);
		SaveKey(wrapper, "height");
		SaveValue(wrapper, m_Height);
		SaveKey(wrapper, "borderColor");
		SaveValue(wrapper, m_BorderColor);
		SaveKey(wrapper, "mipmap");
		SaveValue(wrapper, m_Mipmap);

		EndObject(wrapper);

		return true;
	}
Ejemplo n.º 3
0
	void Light::Save(void* wrapper, bool object)
	{
		if (object)
			StartObject(wrapper);

		// save typeinfo
		SaveKey(wrapper, "type");
		SaveValue(wrapper, "Light");

		SaveKey(wrapper, "light_type");
		SaveValue(wrapper, EnumUtil::LightTypeToString(m_Type));
		SaveKey(wrapper, "color");
		SaveValue(wrapper, m_Color);
		SaveKey(wrapper, "intensity");
		SaveValue(wrapper, m_Intensity);
		SaveKey(wrapper, "inner_angle");
		SaveValue(wrapper, m_InnerAngle);
		SaveKey(wrapper, "outter_angle");
		SaveValue(wrapper, m_OutterAngle);
		SaveKey(wrapper, "falloff");
		SaveValue(wrapper, m_Falloff);
		SaveKey(wrapper, "radius");
		SaveValue(wrapper, m_Radius);
		SaveKey(wrapper, "cast_shadows");
		SaveValue(wrapper, m_CastShadows);

		if (object)
			EndObject(wrapper);
	}
Ejemplo n.º 4
0
bool Pass::Save(void* wrapper)
{
    EnumUtil::Ptr enumUtil = EnumUtil::Instance();

    std::vector<std::string> strs;
    std::string emptyStr;

    StartObject(wrapper);

    SaveKey(wrapper, "name");
    SaveValue(wrapper, m_Name);

    SaveKey(wrapper, "camera");
    SaveValue(wrapper, m_CameraNode == nullptr ? "" : m_CameraNode->GetName());

    std::vector<Shader::Ptr> shaders;
    shaders.reserve(m_ShaderMap.size());
    for (auto pair : m_ShaderMap)
        shaders.push_back(pair.second);

    SaveKey(wrapper, "shaders");
    SaveArray(wrapper, m_ShaderMap.size(), [&](unsigned int index)
    {
        SaveValue(wrapper, shaders[index]->GetName());
    });

    SaveKey(wrapper, "input");
    SaveArray(wrapper, m_InputTextures.size(), [&](unsigned int index)
    {
        SaveValue(wrapper, m_InputTextures[index]->GetName());
    });

    SaveKey(wrapper, "output");
    SaveArray(wrapper, m_OutputTextures.size(), [&](unsigned int index)
    {
        SaveValue(wrapper, m_OutputTextures[index]->GetName());
    });

    SaveKey(wrapper, "index");
    SaveValue(wrapper, (int&)m_RenderIndex);

    SaveKey(wrapper, "blendMode");
    SaveValue(wrapper, enumUtil->BlendModeToString(m_BlendMode));

    SaveKey(wrapper, "compareMode");
    SaveValue(wrapper, enumUtil->CompareModeToString(m_CompareMode));

    SaveKey(wrapper, "cullMode");
    SaveValue(wrapper, enumUtil->CullModeToString(m_CullMode));

    SaveKey(wrapper, "drawMode");
    SaveValue(wrapper, enumUtil->DrawModeToString(m_DrawMode));

    EndObject(wrapper);

    return true;
}
Ejemplo n.º 5
0
bool CPLJSonStreamingParser::StartNewToken(const char*& pStr, size_t& nLength)
{
    char ch = *pStr;
    if( ch == '{' )
    {
        if( m_aState.size() == m_nMaxDepth )
        {
            return EmitException("Too many nested objects and/or arrays");
        }
        StartObject();
        m_aeObjectState.push_back(WAITING_KEY);
        m_aState.push_back(OBJECT);
        AdvanceChar(pStr, nLength);
    }
    else if( ch == '"' )
    {
        m_aState.push_back(STRING);
        AdvanceChar(pStr, nLength);
    }
    else if( ch == '[' )
    {
        if( m_aState.size() == m_nMaxDepth )
        {
            return EmitException("Too many nested objects and/or arrays");
        }
        StartArray();
        m_abFirstElement.push_back(true);
        m_aState.push_back(ARRAY);
        AdvanceChar(pStr, nLength);
    }
    else if( ch == '-' || ch == '.' || isdigit(ch) )
    {
        m_aState.push_back(NUMBER);
    }
    else if( ch == 't' )
    {
        m_aState.push_back(STATE_TRUE);
    }
    else if( ch == 'f' )
    {
        m_aState.push_back(STATE_FALSE);
    }
    else if( ch == 'n' )
    {
        m_aState.push_back(STATE_NULL);
    }
    else
    {
        assert( false );
    }
    return true;
}
Ejemplo n.º 6
0
	bool Shader::Save(void* wrapper)
	{
		EnumUtil::Ptr enumUtil = EnumUtil::Instance();

		StartObject(wrapper);

		SaveKey(wrapper, "name");
		SaveValue(wrapper, m_Name);

		SaveKey(wrapper, "type");
		SaveValue(wrapper, enumUtil->ShaderTypeToString(m_Type));

		SaveKey(wrapper, "path");
		SaveValue(wrapper, m_FilePath);

		EndObject(wrapper);

		return true;
	}