public void HandleHitPoint(List <P3dCommand> commands, List <P3dTransform> repeaters, bool preview, Collider collider, Vector3 worldPosition, Quaternion worldRotation, float pressure) { if (collider != null) { var model = collider.GetComponent <P3dModel>(); if (model != null) { var paintableTextures = P3dPaintableTexture.Filter(model, groups); if (paintableTextures.Count > 0) { var finalColor = color; var finalOpacity = opacity; var finalTexture = texture; P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(ref finalColor); P3dPaintableManager.ModifyOpacity(ref finalOpacity); P3dPaintableManager.ModifyTexture(ref finalTexture); Command.Instance.SetMaterial(blendMode, finalTexture, finalColor, opacity); for (var i = paintableTextures.Count - 1; i >= 0; i--) { var paintableTexture = paintableTextures[i]; P3dPaintableManager.Submit(Command.Instance, model, paintableTexture, preview); } } } } }
private Vector3 HandleHitCommon(Quaternion rotation, float pressure) { var finalOpacity = opacity; var finalRadius = radius; var finalHardness = hardness; var finalColor = color; var finalAngle = angle; var finalTexture = texture; var finalMatrix = tileTransform != null ? tileTransform.localToWorldMatrix : Matrix4x4.identity; var finalAspect = P3dHelper.GetAspect(shape, texture); P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(pressure, ref finalColor); P3dPaintableManager.ModifyAngle(pressure, ref finalAngle); P3dPaintableManager.ModifyOpacity(pressure, ref finalOpacity); P3dPaintableManager.ModifyHardness(pressure, ref finalHardness); P3dPaintableManager.ModifyRadius(pressure, ref finalRadius); P3dPaintableManager.ModifyTexture(pressure, ref finalTexture); rotation = rotation * Quaternion.Euler(0.0f, 0.0f, finalAngle); var finalSize = Command.Instance.SetShape(rotation, scale, finalRadius, finalAspect); Command.Instance.SetMaterial(blendMode, texture, shape, shapeChannel, finalHardness, wrapping, normalBack, normalFront, normalFade, finalColor, finalOpacity, tileTexture, finalMatrix, tileBlend); return(finalSize); }
/// <summary>This allows you to paint all pixels within a sphere at the specified point.</summary> public void HandleHitPoint(List <P3dCommand> commands, List <P3dTransform> repeaters, bool preview, Collider collider, Vector3 worldPosition, Quaternion worldRotation, float pressure) { var finalOpacity = opacity + (1.0f - opacity) * opacityPressure * pressure; var finalRadius = radius + radiusPressure * pressure; var finalHardness = hardness + hardnessPressure * pressure; var finalColor = color; var finalTexture = texture; P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(ref finalColor); P3dPaintableManager.ModifyOpacity(ref finalOpacity); P3dPaintableManager.ModifyRadius(ref finalRadius); P3dPaintableManager.ModifyHardness(ref finalHardness); if (scale == Vector3.one) // Sphere? { Command.Instance.SetLocation(worldPosition, finalRadius); } else // Elipse? { Command.Instance.SetLocation(worldPosition, scale * finalRadius, rotateTo == RotationType.World ? worldRotation : Quaternion.identity); } Command.Instance.SetMaterial(blendMode, finalHardness, finalColor, finalOpacity, finalTexture, strength, tiling); P3dPaintableManager.SubmitAll(Command.Instance, preview, layers, groups, targetModel, targetTexture, repeaters, commands); }
public void HandleHitPoint(List <P3dCommand> commands, List <P3dTransform> repeaters, bool preview, Collider collider, Vector3 worldPosition, Quaternion worldRotation, float pressure) { var finalOpacity = opacity + (1.0f - opacity) * opacityPressure * pressure; var finalRadius = radius + radiusPressure * pressure; var finalDepth = depth + depthPressure * pressure; var finalHardness = hardness + hardnessPressure * pressure; var finalColor = color; var finalAngle = angle; var finalTexture = texture; P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(ref finalColor); P3dPaintableManager.ModifyAngle(ref finalAngle); P3dPaintableManager.ModifyOpacity(ref finalOpacity); P3dPaintableManager.ModifyHardness(ref finalHardness); P3dPaintableManager.ModifyRadius(ref finalRadius); P3dPaintableManager.ModifyTexture(ref finalTexture); worldRotation = worldRotation * Quaternion.Euler(0.0f, 0.0f, finalAngle); Command.Instance.SetLocation(worldPosition, worldRotation, scale, finalRadius, finalTexture, finalDepth); Command.Instance.SetMaterial(blendMode, texture, finalHardness, normalBack, normalFront, normalFade, finalColor, finalOpacity, shape); P3dPaintableManager.SubmitAll(Command.Instance, preview, layers, groups, targetModel, targetTexture, repeaters, commands); }
public void HandleHitPoint(bool preview, int priority, Collider collider, Vector3 worldPosition, Quaternion worldRotation, float pressure) { if (collider != null) { var model = collider.GetComponent <P3dModel>(); if (model != null) { var paintableTextures = P3dPaintableTexture.Filter(model, group); if (paintableTextures.Count > 0) { var finalColor = color; var finalTexture = texture; P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(pressure, ref finalColor); P3dPaintableManager.ModifyTexture(pressure, ref finalTexture); Command.Instance.SetState(preview, priority); Command.Instance.SetMaterial(finalTexture, finalColor); for (var i = paintableTextures.Count - 1; i >= 0; i--) { var paintableTexture = paintableTextures[i]; P3dPaintableManager.Submit(Command.Instance, model, paintableTexture); } } } } }
public void HandleHitRaycast(bool preview, int priority, RaycastHit hit, float pressure) { var model = hit.collider.GetComponent <P3dModel>(); if (model != null) { var paintableTextures = P3dPaintableTexture.Filter(model, group); var finalOpacity = opacity + (1.0f - opacity) * opacityPressure * pressure; var finalRadius = radius + radiusPressure * pressure; var finalColor = color; var finalAngle = angle; var finalTexture = texture; P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(pressure, ref finalColor); P3dPaintableManager.ModifyAngle(pressure, ref finalAngle); P3dPaintableManager.ModifyOpacity(pressure, ref finalOpacity); P3dPaintableManager.ModifyRadius(pressure, ref finalRadius); P3dPaintableManager.ModifyTexture(pressure, ref finalTexture); Command.Instance.SetMaterial(blendMode, finalTexture, finalColor, finalOpacity, shape); for (var i = paintableTextures.Count - 1; i >= 0; i--) { var paintableTexture = paintableTextures[i]; var coord = default(Vector2); switch (paintableTexture.Channel) { case P3dCoord.First: { coord = hit.textureCoord; } break; case P3dCoord.Second: { coord = hit.textureCoord2; } break; } Command.Instance.SetState(preview, priority); Command.Instance.SetLocation(paintableTexture.Current, coord, finalAngle, scale, finalRadius, texture); P3dPaintableManager.Submit(Command.Instance, model, paintableTexture); } } }
private Vector3 HandleHitCommon(Quaternion rotation, float pressure) { var finalOpacity = opacity; var finalRadius = radius; var finalHardness = hardness; var finalColor = color; var finalTileMatrix = tileTransform != null ? tileTransform.localToWorldMatrix : Matrix4x4.identity; P3dPaintableManager.BuildModifiers(gameObject); P3dPaintableManager.ModifyColor(pressure, ref finalColor); P3dPaintableManager.ModifyOpacity(pressure, ref finalOpacity); P3dPaintableManager.ModifyRadius(pressure, ref finalRadius); P3dPaintableManager.ModifyHardness(pressure, ref finalHardness); var finalSize = scale * finalRadius; Command.Instance.SetShape(finalSize, rotateTo == RotationType.World ? Quaternion.identity : rotation); Command.Instance.SetMaterial(BlendMode, finalHardness, finalColor, finalOpacity, tileTexture, finalTileMatrix, tileBlend); return(finalSize); }