Beispiel #1
0
	CoreSyncData SpriteTexture::syncToCore(FrameAlloc* allocator)
	{
		UINT32 size = rttiGetElemSize(mUVOffset) + rttiGetElemSize(mUVScale) + sizeof(SPtr<ct::Texture>) + 
			rttiGetElemSize(mAnimation) + rttiGetElemSize(mPlayback);

		UINT8* buffer = allocator->alloc(size);
		char* dataPtr = (char*)buffer;

		dataPtr = rttiWriteElem(mUVOffset, dataPtr);
		dataPtr = rttiWriteElem(mUVScale, dataPtr);
		
		SPtr<ct::Texture>* texture = new (dataPtr) SPtr<ct::Texture>();
		if (mAtlasTexture.isLoaded(false))
			*texture = mAtlasTexture->getCore();
		else
			*texture = nullptr;

		dataPtr += sizeof(SPtr<ct::Texture>);

		dataPtr = rttiWriteElem(mAnimation, dataPtr);
		dataPtr = rttiWriteElem(mPlayback, dataPtr);

		return CoreSyncData(buffer, size);
	}
Beispiel #2
0
	CoreSyncData Light::syncToCore(FrameAlloc* allocator)
	{
		UINT32 size = 0;
		size += rttiGetElemSize(mPosition);
		size += rttiGetElemSize(mRotation);
		size += rttiGetElemSize(mType);
		size += rttiGetElemSize(mCastsShadows);
		size += rttiGetElemSize(mColor);
		size += rttiGetElemSize(mRange);
		size += rttiGetElemSize(mIntensity);
		size += rttiGetElemSize(mSpotAngle);
		size += rttiGetElemSize(mSpotFalloffAngle);
		size += rttiGetElemSize(mPhysCorrectAtten);
		size += rttiGetElemSize(mIsActive);
		size += rttiGetElemSize(getCoreDirtyFlags());
		size += rttiGetElemSize(mBounds);

		UINT8* buffer = allocator->alloc(size);

		char* dataPtr = (char*)buffer;
		dataPtr = rttiWriteElem(mPosition, dataPtr);
		dataPtr = rttiWriteElem(mRotation, dataPtr);
		dataPtr = rttiWriteElem(mType, dataPtr);
		dataPtr = rttiWriteElem(mCastsShadows, dataPtr);
		dataPtr = rttiWriteElem(mColor, dataPtr);
		dataPtr = rttiWriteElem(mRange, dataPtr);
		dataPtr = rttiWriteElem(mIntensity, dataPtr);
		dataPtr = rttiWriteElem(mSpotAngle, dataPtr);
		dataPtr = rttiWriteElem(mSpotFalloffAngle, dataPtr);
		dataPtr = rttiWriteElem(mPhysCorrectAtten, dataPtr);
		dataPtr = rttiWriteElem(mIsActive, dataPtr);
		dataPtr = rttiWriteElem(getCoreDirtyFlags(), dataPtr);
		dataPtr = rttiWriteElem(mBounds, dataPtr);

		return CoreSyncData(buffer, size);
	}
	void RenderSettings::_getSyncData(UINT8* buffer, UINT32& size)
	{
		UINT32 bufferSize = 0;
		bufferSize += rttiGetElemSize(enableAutoExposure);
		bufferSize += rttiGetElemSize(enableTonemapping);
		bufferSize += rttiGetElemSize(exposureScale);
		bufferSize += rttiGetElemSize(gamma);
		bufferSize += rttiGetElemSize(enableFXAA);
		bufferSize += rttiGetElemSize(enableHDR);
		bufferSize += rttiGetElemSize(enableLighting);
		bufferSize += rttiGetElemSize(enableShadows);
		bufferSize += rttiGetElemSize(enableIndirectLighting);
		bufferSize += rttiGetElemSize(overlayOnly);
		bufferSize += rttiGetElemSize(enableSkybox);

		bufferSize += rttiGetElemSize(autoExposure.histogramLog2Min);
		bufferSize += rttiGetElemSize(autoExposure.histogramLog2Max);
		bufferSize += rttiGetElemSize(autoExposure.histogramPctLow);
		bufferSize += rttiGetElemSize(autoExposure.histogramPctHigh);
		bufferSize += rttiGetElemSize(autoExposure.minEyeAdaptation);
		bufferSize += rttiGetElemSize(autoExposure.maxEyeAdaptation);
		bufferSize += rttiGetElemSize(autoExposure.eyeAdaptationSpeedUp);
		bufferSize += rttiGetElemSize(autoExposure.eyeAdaptationSpeedDown);

		bufferSize += rttiGetElemSize(tonemapping.filmicCurveShoulderStrength);
		bufferSize += rttiGetElemSize(tonemapping.filmicCurveLinearStrength);
		bufferSize += rttiGetElemSize(tonemapping.filmicCurveLinearAngle);
		bufferSize += rttiGetElemSize(tonemapping.filmicCurveToeStrength);
		bufferSize += rttiGetElemSize(tonemapping.filmicCurveToeNumerator);
		bufferSize += rttiGetElemSize(tonemapping.filmicCurveToeDenominator);
		bufferSize += rttiGetElemSize(tonemapping.filmicCurveLinearWhitePoint);

		bufferSize += rttiGetElemSize(whiteBalance.temperature);
		bufferSize += rttiGetElemSize(whiteBalance.tint);

		bufferSize += rttiGetElemSize(colorGrading.saturation);
		bufferSize += rttiGetElemSize(colorGrading.contrast);
		bufferSize += rttiGetElemSize(colorGrading.gain);
		bufferSize += rttiGetElemSize(colorGrading.offset);

		bufferSize += rttiGetElemSize(depthOfField.enabled);
		bufferSize += rttiGetElemSize(depthOfField.focalDistance);
		bufferSize += rttiGetElemSize(depthOfField.focalRange);
		bufferSize += rttiGetElemSize(depthOfField.nearTransitionRange);
		bufferSize += rttiGetElemSize(depthOfField.farTransitionRange);
		bufferSize += rttiGetElemSize(depthOfField.nearBlurAmount);
		bufferSize += rttiGetElemSize(depthOfField.farBlurAmount);

		bufferSize += rttiGetElemSize(ambientOcclusion.enabled);
		bufferSize += rttiGetElemSize(ambientOcclusion.radius);
		bufferSize += rttiGetElemSize(ambientOcclusion.bias);
		bufferSize += rttiGetElemSize(ambientOcclusion.fadeRange);
		bufferSize += rttiGetElemSize(ambientOcclusion.fadeDistance);
		bufferSize += rttiGetElemSize(ambientOcclusion.intensity);
		bufferSize += rttiGetElemSize(ambientOcclusion.power);
		bufferSize += rttiGetElemSize(ambientOcclusion.quality);

		bufferSize += rttiGetElemSize(screenSpaceReflections.enabled);
		bufferSize += rttiGetElemSize(screenSpaceReflections.intensity);
		bufferSize += rttiGetElemSize(screenSpaceReflections.maxRoughness);
		bufferSize += rttiGetElemSize(screenSpaceReflections.quality);

		bufferSize += rttiGetElemSize(shadowSettings.directionalShadowDistance);
		bufferSize += rttiGetElemSize(shadowSettings.numCascades);
		bufferSize += rttiGetElemSize(shadowSettings.cascadeDistributionExponent);
		bufferSize += rttiGetElemSize(shadowSettings.shadowFilteringQuality);

		if (buffer == nullptr)
		{
			size = bufferSize;
			return;
		}

		if (bufferSize != size)
		{
			LOGERR("Invalid buffer size");
			return;
		}

		char* writeDst = (char*)buffer;
		writeDst = rttiWriteElem(enableAutoExposure, writeDst);
		writeDst = rttiWriteElem(enableTonemapping, writeDst);
		writeDst = rttiWriteElem(exposureScale, writeDst);
		writeDst = rttiWriteElem(gamma, writeDst);
		writeDst = rttiWriteElem(enableFXAA, writeDst);
		writeDst = rttiWriteElem(enableHDR, writeDst);
		writeDst = rttiWriteElem(enableLighting, writeDst);
		writeDst = rttiWriteElem(enableShadows, writeDst);
		writeDst = rttiWriteElem(enableIndirectLighting, writeDst);
		writeDst = rttiWriteElem(overlayOnly, writeDst);
		writeDst = rttiWriteElem(enableSkybox, writeDst);

		writeDst = rttiWriteElem(autoExposure.histogramLog2Min, writeDst);
		writeDst = rttiWriteElem(autoExposure.histogramLog2Max, writeDst);
		writeDst = rttiWriteElem(autoExposure.histogramPctLow, writeDst);
		writeDst = rttiWriteElem(autoExposure.histogramPctHigh, writeDst);
		writeDst = rttiWriteElem(autoExposure.minEyeAdaptation, writeDst);
		writeDst = rttiWriteElem(autoExposure.maxEyeAdaptation, writeDst);
		writeDst = rttiWriteElem(autoExposure.eyeAdaptationSpeedUp, writeDst);
		writeDst = rttiWriteElem(autoExposure.eyeAdaptationSpeedDown, writeDst);

		writeDst = rttiWriteElem(tonemapping.filmicCurveShoulderStrength, writeDst);
		writeDst = rttiWriteElem(tonemapping.filmicCurveLinearStrength, writeDst);
		writeDst = rttiWriteElem(tonemapping.filmicCurveLinearAngle, writeDst);
		writeDst = rttiWriteElem(tonemapping.filmicCurveToeStrength, writeDst);
		writeDst = rttiWriteElem(tonemapping.filmicCurveToeNumerator, writeDst);
		writeDst = rttiWriteElem(tonemapping.filmicCurveToeDenominator, writeDst);
		writeDst = rttiWriteElem(tonemapping.filmicCurveLinearWhitePoint, writeDst);

		writeDst = rttiWriteElem(whiteBalance.temperature, writeDst);
		writeDst = rttiWriteElem(whiteBalance.tint, writeDst);

		writeDst = rttiWriteElem(colorGrading.saturation, writeDst);
		writeDst = rttiWriteElem(colorGrading.contrast, writeDst);
		writeDst = rttiWriteElem(colorGrading.gain, writeDst);
		writeDst = rttiWriteElem(colorGrading.offset, writeDst);

		writeDst = rttiWriteElem(depthOfField.enabled, writeDst);
		writeDst = rttiWriteElem(depthOfField.focalDistance, writeDst);
		writeDst = rttiWriteElem(depthOfField.focalRange, writeDst);
		writeDst = rttiWriteElem(depthOfField.nearTransitionRange, writeDst);
		writeDst = rttiWriteElem(depthOfField.farTransitionRange, writeDst);
		writeDst = rttiWriteElem(depthOfField.nearBlurAmount, writeDst);
		writeDst = rttiWriteElem(depthOfField.farBlurAmount, writeDst);

		writeDst = rttiWriteElem(ambientOcclusion.enabled, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.radius, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.bias, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.fadeRange, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.fadeDistance, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.intensity, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.power, writeDst);
		writeDst = rttiWriteElem(ambientOcclusion.quality, writeDst);

		writeDst = rttiWriteElem(screenSpaceReflections.enabled, writeDst);
		writeDst = rttiWriteElem(screenSpaceReflections.intensity, writeDst);
		writeDst = rttiWriteElem(screenSpaceReflections.maxRoughness, writeDst);
		writeDst = rttiWriteElem(screenSpaceReflections.quality, writeDst);

		writeDst = rttiWriteElem(shadowSettings.directionalShadowDistance, writeDst);
		writeDst = rttiWriteElem(shadowSettings.numCascades, writeDst);
		writeDst = rttiWriteElem(shadowSettings.cascadeDistributionExponent, writeDst);
		writeDst = rttiWriteElem(shadowSettings.shadowFilteringQuality, writeDst);
	}