public void FromFlatbuffer(byte[] data) { ByteBuffer bb = new ByteBuffer(data); fbs_BakeSettings settings = fbs_BakeSettings.GetRootAsfbs_BakeSettings(bb); m_version = settings.Version; // shadow settings m_shadowsEnabled = settings.ShadowsEnabled; m_rayStartOffset = settings.RayStartOffset; m_lightSamples = settings.LightBlockerSamples; // ambient occlusion m_ambientOcclusion = settings.AmbientOcclusion; m_normalBend = settings.NormalBend; m_occlusionRayLength = settings.OccluderRayLength; m_occluderStartOffset = settings.OccluderStartOffset; m_occluderSearchSamples = settings.OccluderSearchSamples; if (m_version > 0) { m_aoForceDoubleSidedGeo = settings.AoForceDoubleSidedGeo; } // ambient m_colorCube = new float[settings.ColorCubeLength]; for (int i = 0; i < settings.ColorCubeLength; i++) { m_colorCube[i] = settings.GetColorCube(i); } m_colorGradient = new float[settings.ColorGradientLength]; for (int i = 0; i < settings.ColorGradientLength; i++) { m_colorGradient[i] = settings.GetColorGradient(i); } m_colorSolid = new float[settings.ColorSolidLength]; for (int i = 0; i < settings.ColorSolidLength; i++) { m_colorSolid[i] = settings.GetColorSolid(i); } m_ambientMin = settings.AmbientMin; m_ambientMax = settings.AmbientMax; m_colorMode = (AmbientColorMode)settings.ColorMode; }
public void CopyAmbient(BakeSettings rhs) { m_ambientMin = rhs.m_ambientMin; m_ambientMax = rhs.m_ambientMax; m_colorCube = new float[24]; for (int i = 0; i < 24; ++i) { m_colorCube[i] = rhs.m_colorCube[i]; } m_colorGradient = new float[12]; for (int i = 0; i < 12; ++i) { m_colorGradient[i] = rhs.m_colorGradient[i]; } m_colorSolid = new float[4]; for (int i = 0; i < 4; ++i) { m_colorSolid[i] = rhs.m_colorSolid[i]; } m_colorMode = rhs.m_colorMode; }
public void FromFlatbuffer(byte[] data) { ByteBuffer bb = new ByteBuffer(data); fbs_BakeSettings settings = fbs_BakeSettings.GetRootAsfbs_BakeSettings(bb); m_version = settings.Version; // shadow settings m_shadowsEnabled = settings.ShadowsEnabled; m_rayStartOffset = settings.RayStartOffset; m_lightSamples = settings.LightBlockerSamples; // ambient occlusion m_ambientOcclusion = settings.AmbientOcclusion; m_normalBend = settings.NormalBend; m_occlusionRayLength = settings.OccluderRayLength; m_occluderStartOffset = settings.OccluderStartOffset; m_occluderSearchSamples = settings.OccluderSearchSamples; if (m_version > 0) { m_aoForceDoubleSidedGeo = settings.AoForceDoubleSidedGeo; } if (m_version >= BAKESETTINGS_TESS_V1) { // tessellation m_tessEnabled = settings.TessEnabled; m_maxTessIterations = settings.MaxTessIterations; m_maxTessVertices = settings.MaxTessVertices; } if (m_version >= BAKESETTINGS_TESS_V2) { m_minTessIterations = settings.MinTessIterations; m_maxAOTessIterations = settings.MaxAOTessIterations; m_maxShadowSoftTessIterations = settings.MaxShadowSoftTessIterations; m_maxShadowHardTessIterations = settings.MaxShadowHardTessIterations; m_maxIntensityTessIterations = settings.MaxIntensityTessIterations; m_intesityThreshold = settings.IntesityThreshold; m_avgIntensityThreshold = settings.AvgIntensityThreshold; m_surfaceLightThresholdMin = settings.SurfaceLightThresholdMin; m_surfaceLightThresholdMax = settings.SurfaceLightThresholdMax; m_accessabilityThreshold = settings.AccessabilityThreshold; } // ambient m_colorCube = new float[settings.ColorCubeLength]; for (int i = 0; i < settings.ColorCubeLength; i++) { m_colorCube[i] = settings.GetColorCube(i); } m_colorGradient = new float[settings.ColorGradientLength]; for (int i = 0; i < settings.ColorGradientLength; i++) { m_colorGradient[i] = settings.GetColorGradient(i); } m_colorSolid = new float[settings.ColorSolidLength]; for (int i = 0; i < settings.ColorSolidLength; i++) { m_colorSolid[i] = settings.GetColorSolid(i); } m_ambientMin = settings.AmbientMin; m_ambientMax = settings.AmbientMax; m_colorMode = (AmbientColorMode)settings.ColorMode; }